How to pass an argument in a CreateFnc in a GUI?

1 view (last 30 days)
I want to pass an argument in a GUI's create function. The GUI opening function though is executed "after" the creating on the GUI. So, how do I pass an argument in a create function?
I want to create a drop down menu and the number of options is not constant, it depends on previous processing.

Accepted Answer

Image Analyst
Image Analyst on 20 Aug 2015
You don't. You do stuff in the OutputFcn(), not the CreateFcn(). OutputFcn is executed after the OpeningFcn. You can use global, or setappdata/getappdata(), or other ways described in the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F
  1 Comment
Zina
Zina on 21 Aug 2015
Great, many thanks!
Although setappdata/getappdata should have worked as well, I simply created an empty drop-down menu and then updated the list using set in the OpeningFcn

Sign in to comment.

More Answers (0)

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!