Development of a GUI
Show older comments
Hello,
I have to write a program in MATLAB where certain initial values have to be input by the user. These values are processed by the main program through a couple of functions. The output is a set of 3 numerical values and 6 graphs.
Right now, I have defined all significant variables to be global and define the initial value of each variable in the main program itself.
I wish to create a GUI where all these inputs can be entered by the user and the output can be displayed. From whatever I have read about GUIDE and handles, I don't seem to understand how a completely different output from another file can be displayed as an output on the GUI.
This is what I want:
User enters on GUI -> The GUI program directs all input variables to the main program -> the main program with its two functions executes -> the output must be returned to the GUI program -> the output is displayed on the GUI.
Kindly help.
Thank you, Dheeraj Bharadwaj
Answers (1)
Image Analyst
on 9 Jan 2013
I would recommend you make a GUI called something like GetParameters() or GetUserSettings() or something like that. In the "OK" button of that you read all the controls (radio buttons, edit text boxes, etc.) and set their values as members of a structure:
userSettings.radio1Value = get(handles.radOption1, 'Value');
userSettings.editField = get(handles.edit1, 'String');
Then set that as the output argument:
varargout{1} = userSettings;
Then in your main program, call this function and accept the values.
userSettings = GetUserSettings();
If you need the user to update the parameters "live" without hitting the OK button, then I recommend you just put it all together on one main GUI. There are ways around that but it's complicated: See the FAQ
Categories
Find more on Startup and Shutdown 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!