Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Does simulink support calculation in which a declared variable can change its value?

1 回表示 (過去 30 日間)
TeHsin
TeHsin 2012 年 10 月 9 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
for example, for any declared variable "U"
U = U+5;
U = U*a;
I found that after a variable is calculated by a block, its output always become another variable. such as
C = U+5;
B = U*a;
Thanks
Tehsin
  2 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2012 年 10 月 9 日
what do you mean? It's obvious, after U=U+5, U will change
TeHsin
TeHsin 2012 年 10 月 9 日
Hi Azzi Abdelmalek :
Thanks for your reply.
I want "U" as an global variable,but it is always replaced by an local after using Simulink Coder to generate C code. The C syntax will be ,for example, "loc = U + 1;" not "U = U + 1;"
So, how do I use simulink to create a global that satisfies the C syntax as "U++;" or "U=U*5;"
ex:
simulink:
(in_global)--->[*5]--->(out_local)
simulink Coder:
int out_local;
out_local = in_global * 5;
How to create the code as "in_global = in_global * 5;"
Thank you

回答 (1 件)

Sachin Ganjare
Sachin Ganjare 2012 年 10 月 9 日
If I understand correctly, you want use U as a global variable. Is it correct?
  1 件のコメント
TeHsin
TeHsin 2012 年 10 月 9 日
Hi SACHIN:
Thanks for your reply.
Yes, I want "U" as an global variable.
But the global variable is always replaced by an local after I use Simulink Coder to generate C code.
So, how do I use simulink to create a global that equal to the C syntax as "U++;" or ''U=U*5;"
ex:
simulink:
(in_global)--->[*5]--->(out_local)
simulink Coder:
int out_local;
out_local = in_global * 5;
How to create the code as "in_global = in_global * 5;"
Thank you

この質問は閉じられています。

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by