How to use Switch case and if else in Embedded Matlab Function
1 次查看(过去 30 天)
显示 更早的评论
I am trying to put an ifelse condition under switch statements in Embedded Matlab Function. Can anyone suggest me the correct way of syntax used in Embedded Matlab Function.
Thanks in Advance.
0 个评论
回答(1 个)
Laura Proctor
2012-12-24
2 个评论
Walter Roberson
2012-12-26
Initialize the output before you enter the switch().
Currently, one of the choices you have in the switch does not always assign a value to the output. For example, if you had
if length(A) > 5
B = A + 1;
else
warn('A is too short');
end
then that code does not assign a value to B in the case of the warning.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Install Products 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!