Ch6 Matlab Gui
Ch6 Matlab Gui
Preprocessing p g Data
Why use a GUI in MATLAB? It makes things simple for the end-users of the program. The command line interface Vs. GUI
For the adder GUI, we will need the following components T Two Edit Text T t components t Four Static Text component One Pushbutton component
2. Edit the properties of these components. p You should see the p property p y Inspector. p Double click one of the Static Text components.
2. The second Edit Text component, set the String parameter to 0 Set the Tag parameter input2_editText.
5. Save your GUI under any file name you please. I chose to name mine myAdder. When you save this file, MATLAB automatically generates two files: myAdder.fig and myAdder.m. The .fig file contains the graphics of your interface. The .m file contains all the code for the GUI.
2.
The second method : Launch the GUI from the MATLAB command prompt. Type in the name of the GUI at the command prompt.
For the adder GUI, we will need the following components Add an Edit Text T t component t to t the th GUI figure. fi Add a Slider component onto the GUI figure.
2. Edit the properties of these components. Double click the Edit Text component to bring up the Property Inspector. Ch Change th the String St i property t to t 0, 0 and d change the Tag property to sliderValue_editText.
3. Modify the properties of the Slider component. Sit the Min property to 0, and the Max property to 100. Change the Tag property to slider1. slider1
6. Save your GUI wherever you please with your desired filename.
2.
In the MATLAB editor, click on the within the .m file. Select slider1_Callback.
Now, try to put in different types of inputs to test the GUI. Any input that is not a number, less than zero, or greater than 100 should default the slider to a value of zero.
For the adder GUI, we will need the following components Add an Edit Text T t component t to t the th GUI figure. fi Add a Pop-up Menu component onto the GUI figure.
2. Double click the Static Text component to bring up the Property Inspector. g the String gp property p y to Testing!!!, g and Change change the Tag property to testing_staticText as shown in the figure below:
4. After clicking on the icon, you should now see the following window. Fill in the window as shown below:
2.
In the MATLAB editor, click on the within the .m file. Select popupmenu1_Callback.
3. Modify the properties of the Pushbutton components. p Double click on one of the Pushbutton components. Change the String property to Plot Axes 1, and the Tag property to plotAxes1_pushbutton
4. Double click on the next pushbutton and change the String property to Plot Axes 2 and change the Tag property to plotAxes2_pushbutton. Double click on the final pushbutton and change the String property to Clear Axes and change the Tag property to clearAxes_pushbutton.
2.
In the MATLAB editor, click on the within the .m file. Select plot1_pushbutton_Callback.
This line of code effectively adds the standard toolbar to the GUI, allowing the user to zoom, pan, query the plot, and more.
2.
In the MATLAB editor, click on the within the .m file. Select displayText_pushbutton_Callback.
2. Double click the Check Box component p to bring g up p the Property Inspector. Change the String property to Bold. Change g the Tag gp property p y to bold_checkbox.
Part Three: Radio Buttons, Toggle Buttons, and Button Group Panel
1. Closed GUIDE, reopen it again. add one Button Panel component to the GUI figure. Add three radio buttons onto the button group panel. 2. Double click on the first Radio Button component p to bring g up p the Property Inspector. Change the String property to 8. Change g the Tag gp property p y to fontsize08_radiobutton.
Make sure that the three radio buttons are one hierarchy below the button group icon. icon