FUNCTION REFERENCE

case

Give one branch of a switch block.

Give one branch of a switch block.

Syntax

case value

Syntax

case {value1, value2}

Runs the statements up to the next case, otherwise or end when the switch expression matches value. A cell array of values matches when any element matches. Only valid inside switch.

Example

s = 'b'; switch s; case 'a'; disp(1); case {'b','c'}; disp(2); end   % 2

Differences from MATLAB: none known.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.