我是靠谱客的博主 外向睫毛,这篇文章主要介绍switch matlab函数,Switch - MATLAB & Simulink - MathWorks 中国,现在分享给大家,希望可以做个参考。

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.

9e1be4126feb73131ef4cfa1be51c9b7.png

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内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(188)

评论列表共有 0 条评论

立即
投稿
返回
顶部