概述
C Construct
void add_function(void)
{
y1 = u1 + u2;
}
Procedure
1. Open example model ex_function_call.
The subsystem has two inputs and returns one output.
Selecting the Treat as atomic unit parameter enables parameters on the Code Generation tab. The Code Generation tab provides these customizations:
Function packaging set to Nonreusable function
Function name options set to User specified
Function name specified as add_function
File name options set to Use function name
2. To build the model and generate code, press Ctrl+B.
Results
In ex_function_call.c, the function is called from ex_function_call_step:
/* Model step function */
void ex_function_call_step(void)
{
/* Outputs for Atomic SubSystem: '/Add_Subsystem' */
add_function();
/* End of Outputs for SubSystem: '/Add_Subsystem' */
}
The function prototype is externally declared through the subsystem file, add_function.h:
extern void add_function(void);
The function definition is in the subsystem file add_function.c:
void add_function(void)
{
/* Outport: '/y1' incorporates:
* Inport: '/u1'
* Inport: '/u2'
* Sum: '/Sum'
*/
rtY.y1 = u1 + u2;
}
最后
以上就是高大招牌为你收集整理的matlab function call,Function Call的全部内容,希望文章能够帮你解决matlab function call,Function Call所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复