Read in all inputs on a a GUI when I press the RUN pushbutton.
1 ビュー (過去 30 日間)
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.
回答 (2 件)
mbonus 2016 年 9 月 2 日
編集済み: mbonus 2016 年 9 月 2 日
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
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 2016 年 9 月 2 日
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...