在matlab中怎么用switch编写函数

开关表达式怎么写
2025-03-23 05:49:14
推荐回答(2个)
回答1:

 投我以木瓜,报之以琼琚。匪报也,永以为好也!
  投我以木桃,报之以琼瑶。匪报也,永以为好也!
  投我以木李,报之以琼玖。匪报也,永以为好也!

回答2:

switch switch_expression % a scalar or string
case case_expression1 % a scalar, a string, or a cell array of scalars or strings.
statements
case case_expression2
statements
...
otherwise
statements
end