Empty operator in Matlab switch / chassis?

I read this code, and on line 97 I found the following code:

switch lower(opts.color)
  case 'rgb'
  case 'opponent'
  ...

I have never seen empty statements (as per documentation ). What does it mean?

"If lower(opts.color)either rgb, or opponentthen ..."

or

"If lower(opts.color)there is rgbnothing to do and if he opponentdoes ..."?

+4
source share
1 answer

If the block is caseempty, nothing is done in this particular case. Therefore, if opt.colors 'rgb', no action is taken.

, case, , , otherwise ( opts.color 'hsv', wasn 't /) , opt.colors 'rgb', , , .

if ~strcmpi(opts.color, 'rgb')
    switch lower(opts.color)
        case 'opponent'
            % Do stuff
        case 'hsv'
            % Do other stuff
        otherwise
            % Throw warning
    end
end

case, , case.

switch lower(opts.color)
    case {'rgb', 'opponent'}
        ...
end
+8

Source: https://habr.com/ru/post/1667571/


All Articles