force code gui on start up

3 ビュー (過去 30 日間)
Ingrid
Ingrid 2015 年 12 月 22 日
コメント済み: Ingrid 2015 年 12 月 22 日
so I am trying to create a GUI programmatically instead of through guide which I have used up to now. However, I am stuck with the SelectionChangeFcn of my uibuttongroup (this is so handy! I used to program this exclusivity for all my radiobuttons by hand). How can I make this function to run on start-up as well? So before the user has changed any of the radiobuttons? I tried changing the radiobutton programmatically as suggested here:
it works in the sense that the radiobutton is selected, but the SelectionChangeFcn is not executed. How can I force this. I want the plot to be shown when opening the GUI and not just after changing radiobuttons (than it should update to the correct data plot)

採用された回答

Renato Agurto
Renato Agurto 2015 年 12 月 22 日
編集済み: Renato Agurto 2015 年 12 月 22 日
you could call the function manually.
my_function([], [])
and if your function use for example the event e, you can set it manually:
e.NewValue = handle_of_first_radio_button;
my_function([], e)
An "elegant" soluction would be to use your SelectionChangeFcn just as a caller function. You can call an external function, which can also be called anywhere on your code.
  1 件のコメント
Ingrid
Ingrid 2015 年 12 月 22 日
super thanks, I tried this before but did not know how to set the event.NewValue. I just tried by setting the String property but of course this did not work and I am glad to find a simple solution so fast so thanks

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by