MATLAB 函数
编写面向矩阵的算法以进行数据分析和实现可视化
将 MATLAB® 代码合并到您的 Stateflow® 图中。实现用 MATLAB 更容易表达的算法,例如矩阵计算和数据分析。
主题
- 通过定义 MATLAB 函数重用 MATLAB 代码
在 Stateflow 图中创建并执行 MATLAB 函数。
- Program a MATLAB Function in a Chart
Define the logical behavior of a MATLAB function.
- 在 MATLAB 函数中访问 Simulink 总线信号
此示例说明如何使用 MATLAB 和 Stateflow® 结构体在 MATLAB® 函数中读取和写入 Simulink® 总线信号。MATLAB 结构体使您能够将不同大小和类型的数据捆绑到一个变量中。您可以创建一个 MATLAB 结构体来实现以下目的:
- Export Stateflow Functions for Reuse
Extend the scope of your functions to other blocks in a Simulink® model.
- Reuse Functions by Using Atomic Boxes
Encapsulate reusable functions in a separate namespace.
疑难解答
Debug a MATLAB Function in a Chart
Use breakpoints to debug MATLAB functions.
Initialize Persistent Variables in MATLAB Functions
Specialized semantics impact the way that a function initializes persistent data.