フィルターのクリア

Passing value of a variable From GUI button to Simulink model while running the simulation

1 回表示 (過去 30 日間)
Sir/ Ma'am
I want to create a GUI in matlab which can send on/ off status to a simulink model. The model will take this passed on/off value as a input to one of the block. Actually, its like i dont want to use manual switch in model instead i want same function using GUI button callback.
Can anyone provide any help on this topic? Its urgent.

採用された回答

MarkB
MarkB 2011 年 2 月 24 日
You should be able to use the "set_param" command to programmatically modify properties of blocks from MATLAB. This includes things like the states of switches and gain values. In particular, you might need to replace some of your root-level inports with constant blocks, and then have the GUI set the numerical value of those constants.
  1 件のコメント
HITESH TRIVEDI
HITESH TRIVEDI 2011 年 3 月 7 日
thank you mark
i'll try this and come back to you if more help required

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

その他の回答 (1 件)

Paulo Silva
Paulo Silva 2011 年 2 月 24 日
%pushbutton 1 callback
set_param(gcs,'SimulationCommand','start')
%pushbutton 2 callback
set_param(gcs,'SimulationCommand','stop')
%get the status of the system
get_param(gcs, 'SimulationStatus')
I recommend to replace gcs with your system name ('mysystem')
More info can be found in your matlab documentation

カテゴリ

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