How can I set a variable in my workspace as a constant?

80 ビュー (過去 30 日間)
Tom Baker
Tom Baker 2015 年 11 月 17 日
コメント済み: Walter Roberson 2015 年 11 月 19 日
Hello everyone,
I'm building a model in Simulink and the size of a few of my state flows depend on a variable in my workspace. I set this variable once in my initialisation, before running the Simulink model. The variable won't change for the duration of the simulation, it's a constant. If I now try and integrate my state flow with a discrete time integrator, I get the error: The discrete time integration with variable state flows is not supported. To work around this problem I have tried to set the variable from my workspace to not "tunable" in my simulink model, which sadly does not have any effect.
Is there a way to let Matlab/Simulink know that the variable that I've set once at the beginning will not change for the duration of the simulation?
Thank you in advance! Tom

回答 (1 件)

Satyajeet Sasmal
Satyajeet Sasmal 2015 年 11 月 19 日
The link below shows you how to set a constant property so that it can be used later. And these values cannot be changed once set:
I hope this was helpful.
-Satya
  1 件のコメント
Walter Roberson
Walter Roberson 2015 年 11 月 19 日
But can these be used that way in Simulink? Simulink has its own peculiar ideas about what is constant or not.

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

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by