概述
C Construct
switch (u1)
{
case 2:
y1 = u2;
break;
case 3:
u3;
break;
default:
y1 = u4;
break;
}
Modeling Pattern for Switch: Switch Case block
One method to create a switch statement is to use a Switch Case block from the Simulink > Signal Routing library.
1. Open example model ex_switch_SL.
The model contains a Switch Case Action Subsystem. The Switch Case block takes an integer input, therefore, the input signal u1 is type cast to int32.
2. To build the model and generate code, press Ctrl+B.
The code implementing the switch construct is in the ex_switch_SL_step function in ex_switch_SL.c:
/* Exported blo
最后
以上就是外向睫毛为你收集整理的switch matlab函数,Switch - MATLAB & Simulink - MathWorks 中国的全部内容,希望文章能够帮你解决switch matlab函数,Switch - MATLAB & Simulink - MathWorks 中国所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复