Read in all inputs on a a GUI when I press the RUN pushbutton.

1 view (last 30 days)
I am a newbie with MATLAB GUIs. I have a GUI with multiple inputs (text boxes, radio buttons and check mark selections) and a RUN button to begin execution. How can I get the program to refresh all values from all the current entries in the whole GUI before it starts the execution? When I start the GUI, all entries will be default. I don't want the user to have to "touch" all entries before executing, but only change a few that need to be changed from default. It seems that a Callback function for an entry is called only if the entry in the corresponding field is changed by the user. So, the "unchanged" entries are not read in at all, even when they have valid values in them.
Thanks.

Answers (2)

mbonus
mbonus on 2 Sep 2016
Edited: mbonus on 2 Sep 2016
Create a push button that will take the values from all the other uicontrols and have it pass them into the function. In the callback it will retrieve the values like this
varname = get(hObject,'Value')
you can retrieve hObject, which is the specific uicontrols handle by doing
findobj('tag',objTagString)
Just do this for every value in the pushbuttons callback and then pass them into the function.
Edit: just noticed that you already have a run button so just toss that into its callback

Manohar Vohra
Manohar Vohra on 2 Sep 2016
Hi,
In order to use any values placed in the textbox whether it is changed or not, in the 'run' pushbutton callback, you can use the get() function and assign it to a variable.
Please be a little more specific on what do you want to do...

Categories

Find more on Migrate GUIDE Apps 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!