Get value from simulink model to matlab gui while simulink is running

13 ビュー (過去 30 日間)
Mitesh Farsodia
Mitesh Farsodia 2011 年 8 月 19 日
回答済み: ian barahona 2020 年 6 月 1 日
With respect to following post I have some doubts related to command get_param:
1) When I use this command it returns me empty vector. 2) Can we use this command for any block like display, demux and out or it has to be Gain block only?
Thanks Mitesh

採用された回答

Fangjun Jiang
Fangjun Jiang 2011 年 8 月 19 日
I believe it can be done that way and it should apply to all types of blocks. Remember you can't just use get_param() alone, you need to set up the event listener and callback function. See Guy Rouleau's anser in this post. It points to the link from the Mathworks website.
  15 件のコメント
Mitesh Farsodia
Mitesh Farsodia 2011 年 8 月 24 日
I am sorry for that confusion. I will try to rephrase my problem and will put it as new question.
Yes I did create a event listner. So we can not chnage the update rate of event listner?
Fangjun Jiang
Fangjun Jiang 2011 年 8 月 24 日
My understanding is, whenever the event happened, the pre-defined callback function will be executed.

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

その他の回答 (3 件)

Paulo Silva
Paulo Silva 2011 年 8 月 19 日
  1. When you use get_param where? what block and what code?
  2. That command can only get the parameters supported by the block you are using as argument.
  5 件のコメント
Mitesh Farsodia
Mitesh Farsodia 2011 年 8 月 19 日
but when I use different type of block instead of 'Gain' block, it's giving me this error
"add_exec_event_listner can add listener only when block diagram is executing"
Kristof
Kristof 2014 年 4 月 13 日
You first have to start simulation, and right after that you can add eventlisteners.

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


Arunkumar Muthukumaran
Arunkumar Muthukumaran 2015 年 12 月 17 日
Another solution would be to use a Matlab function in your model to update the GUI handle in each timestep. Pass the value from model which needs to be displayed in GUI and update GUI handle respectively.

ian barahona
ian barahona 2020 年 6 月 1 日
Another posible solution is using another block instead of a "Gain" block. i used a "Product" and worked like it was a "Gain" block. rto = get_param('lm35_sim/Product','RuntimeObject');

カテゴリ

Help Center および File ExchangeSchedule Model Components についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by