Creating a GUI in Matlab USING GUIDEBy Sahil Potnis, VIT, Mumbai
STEP 1: Open Matlab and type „guide‟ in command window . Guide stands for GUI Development Environment.OR You can select File-> new-> GUI.It is one and the same thing......By Sahil Potnis, VIT, Mumbai
STEP 2: Select a standard template from the list:Say for example : GUI with uicontrols Save the GUI with a certain name –abc This generates a abc.m file with the GUI code. Now , you can play with the code. Do not alter the initialization code up to line no:74By Sahil Potnis, VIT, Mumbai
STEP 3: All objects present within the GUI have their own tags. Double click on an object to display it „s properties Tag property will show you the existing tag of that object. Callback and Create function of these are associated with this tagBy Sahil Potnis, VIT, Mumbai
If you change the tag, and save the file automatically abc.m will be updated (note-Do not alter the .m file to change the tag, make changes in .fig file and save it). Ta of your selected object is displayed at the right hand bottom corner of your .fig window.By Sahil Potnis, VIT, Mumbai
Now I will explain rest of basics using reference to the “Density * volume =Mass example” Density, Volume are the Edit text boxes in which user can enter the values Mass is the static text box in which answer is displayed. Calculate and Reset are the two Pushbuttons while Units consists of two radio buttonsBy Sahil Potnis, VIT, Mumbai
STEP 4 : Mutual Exclusivity of these radio buttons is preserved as they are embedded within a “button group‟‟ container. A create function is essential when a value is to be obtained from the User A callback function is essential when a value is to be assigned to a certain tag (static text) Or a certain object has to perform a specific task (pushbutton)By Sahil Potnis, VIT, Mumbai
Functions related to specific Objects can be viewed by using : View CallbackBy Sahil Potnis, VIT, Mumbai
You can further change the „calculate callback‟ function as per your usage: Even a function can be created within „calculate‟ as follows:Mass=fxname(handles.metricdata.density,handles.metricdat.volume) Save a fxname.m file within the same folder and write the function within that file.By Sahil Potnis, VIT, Mumbai
Function [mass]=fxname(density,volume)%CODE%return Make sure the parameter names and number of parameters within the function and main file match.By Sahil Potnis, VIT, Mumbai
EXPECTED OUTCOME : You can now create a simple User Interface with User Input and perform certain operations on those input values.... Keep on trying new things.....Its the best way to learn.!!Watch out this space for tutorials on Matlab.... By Sahil Potnis, VIT, Mumbai
Thank You For further advanced Matlab programming visit : http://sahilpotnis.blogspot.in/ Or drop me a mail at :email@example.comBy Sahil Potnis, VIT, Mumbai
A particular slide catching your eye?
Clipping is a handy way to collect important slides you want to go back to later.