set_param Command calls OpeningFcn

2 ビュー (過去 30 日間)
Arno
Arno 2013 年 4 月 10 日
Hi guys,
I'm programming on a GUI for my simulink model with guide. To set Parameters in a simulink Block and to start the model from gui the appropriate set_param commands are used. But every time a set_param command is executed by matlab the guide OpeningFcn function is called.
Is there a way to avoid this?
  3 件のコメント
Arno
Arno 2013 年 4 月 11 日
Hi, I'm using this two set_param commands
%setting Parameters in S-functionBlock
set_param('Doublependulum_Sim_V2/S-Function','Parameters',num2str(handles.startpara.data,'%g '))
%starting Simulink Model
set_param(modelName, 'SimulationCommand','start')
both set_param commands call the OpeningFcn function. In the code these set_param commands are located in a Callbackfunction of a button.
Ryan G
Ryan G 2013 年 4 月 11 日
I'm not seeing this issue with a simple model/GUI. What version are you using? What callback are these currently in? Have you tried doing this with a simple GUI/Model to verify this is the issue?

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

回答 (1 件)

Babak
Babak 2013 年 4 月 10 日
If the GUI is not open, as soon as you call to open it, the OpeningFcn runs. Now its up to you what to put in the Opening Fcn. You can write the OpeningFcn such that the GUI's initialization parameters would be set according to the Simulink model's parameters like for example using the Simulink workspace parameters or model parameters.

カテゴリ

Help Center および File ExchangeModel, Block, and Port Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by