- Create a Simulink function at the top level with a scope of global
- Inside the simulink function, Add the matlab function that you are interested and add the inputs/outputs of the matlab function as arguments
- Now this Simulink function can be called in the SF charts at any level.
Is there a way to reuse the same matlab function in multiple stateflow charts?
1 次查看(过去 30 天)
显示 更早的评论
I have a number of utility matlab functions that I want to re-use in multiple stateflow charts. I can create (copy/paste) the same matlab function in different stateflow charts. However, its very hard to maintain for a large project (i.e difficult to fix bugs or change function implementation). Is there a way to implement matlab function once and call it from different stateflow chart? Does code generator work with this? Thanks.
0 个评论
回答(1 个)
Muthukumar Ganesan
2022-7-27
Hi Yev,
Yes it is possible, please follow this procedure.
Hope this helps.
Thanks.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!