MATLAB: How to insert mfile to GUI

datadata acquisitiondata importgraphgui

i have skripst in mfile to read and proces the data. i have 4 file mfile. 1 file to read and identification a file data, 1 file to proces many data, n 2 file to chose how many data u need to proces (day, mounth, year)
now i need insert the skript to the GUI..
can u help me..

Best Answer

Hi Soni,
You have to approach this in two steps. Firstly, you need to learn to use some basic features of GUIDE. Thus,
  1. Watch the demo Creating a GUI with GUIDE. It is good!
  2. Make a very simple GUI with three buttons, [Rain], [Sun], [Wind]. Pushing [Rain] shall show "It's raining" in the command window, etc.
When you are somewhat comfortable with doing the basic exercises you proceed to next step.
Design
  1. Make a simple sketch of the GUI you want to develop. Search "Design a GUI" in the online help. Make another sketch until you are happy with it. Remember professionals at The Mathworks have refined these descriptions over many years.
  2. Write a little description on how the user is supposed to use the GUI.
  3. You should try to minimize the interaction between your domain specific functions (the code that deals with weather, rain, etc.), e.g ReadManySoniData, and the GUI-code. You do not want to have many versions of the domain specific functions.
Implementation
This code snippet is copied from the example "GUI with UiControls"
% --- Executes on button press in calculate.
function calculate_Callback(hObject, eventdata, handles)
% hObject handle to calculate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
mass = handles.metricdata.density * handles.metricdata.volume;
set(handles.mass, 'String', mass);
This function is called when the user push [Calculate]. I recommend that you include only a minimum of domain specific code in these callback-functions. Something like
disp( 'calculate_Callback' ) % to know that the function is executed
file_spec = handles.domaindata.file_spec;
RainData = ReadManySoniData( file_spec );
handles.domaindata.RainData = RainData;
when you debug the callback-function put a breakpoint at disp(...).
Later this may be replaced by
handles.domaindata.RainData=ReadManySoniData(handles.domaindata.file_spec);
.
Tip
An alternative to diagrams integrated in the GUI might be separate figures, e.g. created by plot. It is simple to implement. Cons: the GUI will be unhappy if you delete the figure without letting the GUI know and the figures tends to disappear under other windows. To avoid the latter download ALWAYSONTOP and run
alwaysontop auto
before you start your GUI
.
Be aware that this is sketchy!
--- To be continued ---