Simulink fixed-step size protected variable name
古いコメントを表示
Hi,
Is there any protected variable name for the Fixed-step size solver property pane that can be used in a block?
For instance, if I specify a number, let's say 0.001, I would like to use the variable name that points to the value in the configuration parameter. I know that a user specify a variable name and call it from workspace, but that is not practical in my model.
Thanks
採用された回答
その他の回答 (1 件)
Walter Roberson
2022 年 5 月 18 日
編集済み: Walter Roberson
2022 年 5 月 18 日
0 投票
"Is there any protected variable name for the Fixed-step size solver property pane that can be used in a block?"
No, there is not.
Would using a Datastore be acceptable for your purposes? That is, use the datastore variable to configure the solver step size, and then the same value would be available for reading anywhere else.
I do not know what would happen if you were to change the variable value during execution, especially without using set_param.
You talk about MATLAB scripts in a way that suggests to me that you are thinking of having a MATLAB script that sets the value and then calls sim(). But as you are not being specific on the wording you are also ruling out using a MATLAB Function Block that uses get_param and lets the result be a signal.
Now that I think of it... You could perhaps create a Constant block with an InitFcn callback that used get_param to fetch the step size and set the constant value; then feed the constant to wherever needed. That would be self-contained.
1 件のコメント
Fangjun Jiang
2022 年 5 月 18 日
I don't see a way that a Datastore can be used to achieve it.
カテゴリ
ヘルプ センター および File Exchange で Programmatic Model Editing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!