How do I convert this C code into a Simulink model?

2 ビュー (過去 30 日間)
J H
J H 2016 年 7 月 23 日
コメント済み: J H 2016 年 7 月 25 日
I am trying to convert some C code into a Simulink block diagram without using S-Functions (since they incorporate C code). The C code that I am trying to convert has the following format:
if true
myVar += myConst1 - myConst2*myConst3
\\ More code changing other variables etc.
myVar -= myConst4
end
How would I model lines 1 and 3 in the code provided above?
I was thinking that I could save the signal myVar from Simulink dynamically so that I can use it in another part of my Simulink model, but I need it to save the signal as the model is running (not just when the simulation is done). Is there any way to accomplish what I need?
Thank you in advance!

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2016 年 7 月 23 日
You can use a memory bloc or a unit delay block
  1 件のコメント
J H
J H 2016 年 7 月 25 日
Thanks. This is exactly what I am looking for.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink Functions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by