フィルターのクリア

Is there a way to reuse the same matlab function in multiple stateflow charts?

1 回表示 (過去 30 日間)
Yev Segal
Yev Segal 2016 年 9 月 21 日
回答済み: Muthukumar Ganesan 2022 年 7 月 27 日
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.

回答 (1 件)

Muthukumar Ganesan
Muthukumar Ganesan 2022 年 7 月 27 日
Hi Yev,
Yes it is possible, please follow this procedure.
  1. Create a Simulink function at the top level with a scope of global
  2. Inside the simulink function, Add the matlab function that you are interested and add the inputs/outputs of the matlab function as arguments
  3. Now this Simulink function can be called in the SF charts at any level.
Hope this helps.
Thanks.

カテゴリ

Help Center および File ExchangeComplex Logic についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by