Graphically define a function with Simulink blocks
Simulink / User-Defined Functions
SimEvents
这金宝appSimulink函数block is a子系统块预先配置作为用Simulink以图形方式定义函数的起点金宝app®blocks. The block provides a text interface to function callers. You can call a金宝appSimulink函数block from aFunction Callerblock, aMATLABFunction块或状态流®chart. See调用一个仿真软金宝app件功能from a Model。
有关块参数的说明,请参阅子系统。
您可以在金宝app序列查看器。观看者显示何时与参数和返回值进行呼叫。
您可以选择一个金宝appSimulink函数orFunction Caller突出显示与之相关的块。要在打开图或新标签中显示相关块,请在选择后出现的省略号上暂停。然后,选择Related Blocks从动作栏。当多个块对应于所选块时,相关块的列表将打开。您可以通过在文本框中输入搜索词来过滤相关块的列表。从列表中选择一个相关的块后,窗口焦点转到显示相关块的开放图或新选项卡。
这function interface appears on the face of a金宝appSimulink函数堵塞。编辑块文本添加和删除论点INPORTblocks and参数外口从函数定义块。编辑还设置了Function name参数Triggerblock within the金宝appSimulink函数堵塞。
例如,输入y = myfunction(u)
面对金宝appSimulink函数block adds one Argument Inport block (你
) and one Argument Outport block (y
) within the subsystem.
当使用一个函数调用函数时Function Caller块,参数功能原型in theFunction Caller块必须完全匹配您在金宝appSimulink函数堵塞。This match includes the name of the function and the names of input and output arguments. For example, the金宝appSimulink函数block and theFunction Caller阻止两者使用参数名称你
一个ndy
。
When calling a function from a Stateflow transition or state label, you can use different argument names. For example, the金宝appSimulink函数块用途X
一个ndy
当状态流过渡使用时的论点x2
一个ndY2
一个rguments to call the function.
一般来说,功能通话子系统块提供了与直接信号连接更好的信号可追溯性金宝appSimulink函数block, whereas a金宝appSimulink函数block eliminates the need for routing input and output signal lines through the model hierarchy.
属性 | 功能通行子系统块 | 金宝appSimulink功能块 |
---|---|---|
Method of executing/invoking function | 使用信号线触发 | 使用函数名称通过引用调用 |
正式输入参数(论点INPORTblocks) and output arguments (参数外口blocks) | No | 是的 |
本地输入(Inport块)和输出(出去port堵塞) | 是的 | 是的 |