buff = char(buff);
switch buff
case 'none'
z = 0;
case '30min'
z = 12;
case '60min'
z = 24;
end
If the input value contains only numeric, then conversion to char is not necessary. e.g. case 0, case 30 case 60. Otherwise it's needed in switch as shown abov In your program, the switch case is not being executed and directly jumps to next line after end.
1 Comment
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/654138-why-do-i-have-unrecognized-function-error-for-z#comment_1148053
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/654138-why-do-i-have-unrecognized-function-error-for-z#comment_1148053
Sign in to comment.