MATLAB: Reference to a cleared variable lot. Error in parking (line 13) switch lot

functioninput arguments

function cost = parking(lot,timeinminutes)
menu('Select your desired parking lot: ','L','S');
switch lot
case 'L'
disp('How long, in minutes, will you park?')
if timeinminutes<=60

Best Answer

  • if lot is being defined within the function you don't need to have it as an input. as what ever you're putting in that variable "slot" will be overwritten immediately by the input();
    How are you calling the parking() function from the main program?