和C语言中基本相同,只是每个case之后不用加break;
假设
method = 'Bilinear';
执行下面判断
switch lower(method)
case {'linear','bilinear'}
disp('Method is linear')
case 'cubic'
disp('Method is cubic')
case 'nearest'
disp('Method is nearest')
otherwise
disp('Unknown method.')
end
输出:
Method is linear