MATLAB: I want the user to input which loop to run

inputloopsMATLAB

I am trying to have numberous loops in my program but the user must input which to use for example A would start loop 1 while B would start loop 2. How can I fix this? I will not enter my entire code since this is a homework assignment I don't want my entire code displayed for cheating purposes.
disp('Below please input one of the choices listed')
Method = input('Please input your choice: ')
if Method == A
Days = Data(:,1)
It keeps saying A as the input is not a variable.

Best Answer

If ‘A’ is a character or string (although in your input statement tyou did not request a string), use the strcmp (link) function:
if strcmp(Method, 'A')
Depending on what you want to do, a switch, case, otherwise (link) block might be more efficient.