Simulink 函数
创建可在 Simulink 模型中访问的函数
Simulink® 函数是一种计算单元,为它提供一组输入之后,它会计算出一组输出。由于 Simulink 函数为其函数定义和函数调用方提供了一个通用的文本接口,因此您可以选择如何定义函数。可能的函数定义包括使用:
Simulink Function 模块中的 Simulink 模块
导出的 Stateflow® 图形函数中的 Stateflow 状态转移
导出的 Stateflow MATLAB 函数中的 MATLAB® 代码语句
定义函数后,可以使用 Function Caller 模块、MATLAB Function 模块或 Stateflow 图来调用该函数。

模块
主题
了解 Simulink 函数
- Simulink Functions Overview
Functions in a Simulink model that share a common text interface with function callers. - 向模型添加 Simulink 函数
使用 Simulink Function 模块或从 Stateflow 图导出的图形或 MATLAB 函数定义一个 Simulink 函数。 - Call a Simulink Function from a Model
Call a Simulink function from a Simulink model using a Function Caller block, a MATLAB Function block, or a Stateflow chart. - Scoped, Global, and Port-Scoped Simulink Function Blocks Overview
Specify visibility and access of Simulink Function blocks. - Simulink Function Blocks in Referenced Models
Add and access functions in model components.
限定作用域的 Simulink 函数
- Scoped Simulink Function Blocks in Subsystems
Limit the scope of a function to a subsystem. - Scoped Simulink Function Blocks in Models
Limit the scope of a function to a model. - Define Diagnostic Services Using Simulink Functions
Create a diagnostic service with functions where callers pass an error code. - Resolve Error: Block Is Unable to Call The Scoped Simulink Function
Troubleshoot block unable to call the function error in Simulink.
Simulink 中的客户端-服务器接口
- Model Client-Server Communication Using Function Ports
Use function ports to model client and server components in a distributed service architecture. - Service-Oriented Sensor Modeling (System Composer)
Use a service interface to call services from multiple instances of a referenced component. - Author Service Interfaces for Client-Server Communication (System Composer)
Create client and server ports, author service interfaces in Interface Editor, associate interfaces with ports.