switch
Form
switch expression_ref
case expression1
...
case expression2
...
otherwise
...
end
Notes
- The documented help says
expressioncan be a scalar, vector, string, or audio object.
Example
The historical help gives an example user-defined function:
function out = test_switch(in)
switch in
case 99
out=9999;
case "bj"
out=in++"kwon";
case tone(440,10)@-20
out=in.rms;
case noise(30)
out="you can never have this output.";
otherwise
out="Not one of prepared input items.";
end
Example calls shown in the help:
AUX> test_switch(99)
ans =
9999
AUX> test_switch("bj")
ans =
"bjkwon"
AUX> test_switch(tone(440,5+5)@-20)
ans =
-20
AUX> test_switch(99.0001)
ans =
"Not one of prepared input items."
AUX> test_switch(noise(30))
ans =
"Not one of prepared input items."
Current source basis:
switch.htmlinhtml-CREATED