how to insert mfile to GUI

8 ビュー (過去 30 日間)
Soni huu
Soni huu 2012 年 9 月 4 日
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..
  2 件のコメント
Image Analyst
Image Analyst 2012 年 9 月 4 日
Does copy and paste not work for you?
Soni huu
Soni huu 2012 年 9 月 4 日
i dont know where to copy., i never use GUI..

サインインしてコメントする。

採用された回答

per isakson
per isakson 2012 年 9 月 4 日
編集済み: per isakson 2012 年 9 月 4 日
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 ---
  5 件のコメント
per isakson
per isakson 2012 年 9 月 5 日
編集済み: per isakson 2012 年 9 月 5 日
Back to step 1! Keep it simple. Download 41 Complete GUI Examples and put them in a separate folder. Use them and the Matlab help!
The "check buttons" (or rather radio buttons) are probably in a hggroup, which automagically unselect all others when you select one of them.
Are you saying that the change of the static text is not intended? Do not include code that you do not understand.
I guess that you have some code in the callback triggered by the radio button that changes the static text. Compare the code-snippet below, which comes from the example "GUI with UiControls"
% --- Executes when selected object changed in unitgroup.
function unitgroup_SelectionChangeFcn(hObject, eventdata, handles)
% hObject handle to the selected object in unitgroup
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if (hObject == handles.english)
set(handles.text4, 'String', 'lb/cu.in');
set(handles.text5, 'String', 'cu.in');
set(handles.text6, 'String', 'lb');
else
set(handles.text4, 'String', 'kg/cu.m');
set(handles.text5, 'String', 'cu.m');
set(handles.text6, 'String', 'kg');
end
Soni huu
Soni huu 2013 年 1 月 23 日
編集済み: Soni huu 2013 年 1 月 23 日
sorry... long time no see... i have job in smallvillage, no internet conection.. i dont know how to design.. good design for my gui.. give me ur solution please..
I have to design GUI for my mfile code, this the illustration of process my matlab code
my GUI design (but i acepted any recommendation) :

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDesktop についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by