| MATLAB® case Evaluates Strings A useful difference between switch-case statements in MATLAB® and C is that you can specify string values in MATLAB case statements, which you cannot do in C. switch(method) case 'linear' disp('Method is linear') case 'cubic' disp('Method is cubic') end Multiple Conditions in a case Statement You can test against more than one condition with switch.Thefirstcase below tests for either a linear or bilinear method by using a cell array inthecasestatement. switch(method) case {'linear', 'bilinear'} disp('Method is linear or bilinear') case (<and so on>) end Implicit Break in switch-case In C, if you do not end each case with a break statement, code execution falls through to the following case. In MATLAB, case statements do not fall |