你好!你可以开配置中添加API,具体是model setting (Ctrl+E)->Simulation Target, 填写.c和.h。
代码生成也许要嵌进去,model setting (Ctrl+E)->Code Genaration->Custom Code填写.c和.h。
之后你用statflow调用即可,stateflow需要选择C语言
可以参考这个例子https://ww2.mathworks.cn/help/stateflow/ug/calling-c-functions-in-actions.html?searchHighlight=stateflow%20call%20c%20function&s_tid=srchtitle_stateflow%20call%20c%20function_3