How to create a simulink parameter that bind to simulink model?

Hello, Now I am learning the Simulink example model rtwdemo_rsim_vdp. I found that when I opened this model in Matlab command window, three variables "INIT_X1","INIT_X2","MU" appeared in workspace. Now I want to add a parameter named "Test_X1" that can also appears in workspace when I open the model, how to create it?
Thanks!

 採用された回答

ES
ES 2017 年 10 月 13 日

0 投票

You can do it via PreLoadFcn of the model (Go to File->Model Properties->Model Properties)
Please also note, in the CloseFcn of the model, they are clearing these variables.
Hint: PreLoadFcn is a model callback that is automatically run when the model is loaded.
CloseFcn automatically runs when you close the model. The model has many such callback functions.

1 件のコメント

Li Huang
Li Huang 2017 年 10 月 13 日
Thank you very much! You answered my question completely.

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

その他の回答 (0 件)

カテゴリ

製品

質問済み:

2017 年 10 月 13 日

コメント済み:

2017 年 10 月 13 日

Community Treasure Hunt

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

Start Hunting!

Translated by