, . . , .
: (Tag); , (String)
, , ( Value Max, 1).
, : , , , .
:
1) ( ) a=.
2) a.
3) ( ) b=.
4) b.
5) .
6) , , , .
7) , .
8) .
, , . 2.42.1.
, , . 2.42.2. 2.42.1, 2.42.2, 2.42.3 , .
2.42.1. (, ,
).
Tag | text_a | text_b | edit_a | edit_b | uipanelm |
String | a= | b= | -pi | pi | |
Title |
2.42.2. ().
Tag | rb1 | rb2 | rb3 | rb4 |
String | y1=cos(x) | y2=sin(x) | y3=exp(cos(x)) | y4=exp(sin(x)) |
Title |
2.42.3. (, ).
Tag | axes_ my | pushbutton_my |
String | ||
Title |
- Callback .
% --- Executes on button press in pushbuttonm.
function pushbuttonm_Callback(hObject, eventdata, handles)
% hObject handle to pushbuttonm (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
. 2.42.1. .
. 2.42.2. .
% edit_a ,
|
|
% a
% ( String
% edit_a get,
%
% handles.edit_a)
a=str2double(get(handles.edit_a,'String'));
% edit_b ,
% b
b=str2double(get(handles.edit_b,'String'));
% dx
dx=(b-a)/1000;
% x
x=a:dx:b;
% y1
y1=cos(x);
% y2
y2=sin(x);
% y3
y3=exp(cos(x));
% y4
y4=exp(sin(x));
% y1(x)
if get(handles.rb1,'Value')==1
% y1(x)
plot(x,y1)
% y2(x)
elseif get(handles.rb2,'Value')==1
% y2(x)
plot(x,y2)
% y3(x)
elseif get(handles.rb3,'Value')==1
% y3(x)
plot(x,y3)
% y4(x)
elseif get(handles.rb4,'Value')==1
% y4(x)
plot(x,y4)
end
% , x,
%
if get(gca,'XGrid')=='off'
set(gca,'XGrid','on');
end
% , y,
%
if get(gca,'YGrid')=='off'
set(gca,'YGrid','on');
end
. 2.42.3 .
. 2.42.3. .
, . Value 1, 0 . : X Y.
, 2.42.4 2.42.5 (. 2.42.4).
2.42.4. (, ).
Tag | uipanel_grid | checkbox_x | checkbox_y |
String | X | Y | |
Title |
2.42.5. ( , , ).
Tag | editm | listboxm | pushbuttonm |
String | |||
Title |
. 2.42.4. .
.
function pushbuttonm_Callback(hObject, eventdata, handles)
% hObject handle to pushbuttonm (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
a=str2double(get(handles.edit_a,'String'));
b=str2double(get(handles.edit_b,'String'));
dx=(b-a)/1000;
x=a:dx:b;
y1=cos(x);
y2=sin(x);
y3=exp(cos(x));
y4=exp(sin(x));
if get(handles.rb1,'Value')==1
plot(x,y1)
elseif get(handles.rb2,'Value')==1
plot(x,y2)
elseif get(handles.rb3,'Value')==1
plot(x,y3)
elseif get(handles.rb4,'Value')==1
plot(x,y4)
end
% , x
|
|
% ,
% ( )
if get(handles.checkbox_x,'Value')==1
set(gca,'XGrid','on');
else
set(gca,'XGrid','off');
end
% , y
% ,
% ( )
if get(handles.checkbox_y,'Value')==1
set(gca,'YGrid','on');
else
set(gca,'YGrid','off');
end
. , , Callback checkbox_x checkbox_y. :
% --- Executes on button press in checkbox_x.
function checkbox_x_Callback(hObject, eventdata, handles)
% hObject handle to checkbox_x (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of checkbox_x
% " X"
% ( gca),
% X ,
% , X
% ( - )
if get(hObject,'Value')==1
set(gca,'XGrid','on');
else
set(gca,'XGrid','off');
end
% --- Executes on button press in checkbox_y.
function checkbox_y_Callback(hObject, eventdata, handles)
% hObject handle to checkbox_y (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of checkbox_y
% " Y"
% ( gca),
% Y ,
% , Y
% ( - )
if get(hObject,'Value')==1
set(gca,'YGrid','on');
else
set(gca,'YGrid','off');
end
. 2.42.5 .
. 2.42.5. .
, , . , (String) (Value). - , Value . , String, . .
, , , .
: editm, listboxm pushbottomm. . 2.42.6 .
. 2.42.6. .
( ) String. (. 2.42.7).
. 2.42.7. .
Callback pushbottomm, .
% --- Executes on button press in pushbuttonm.
function pushbuttonm_Callback(hObject, eventdata, handles)
% hObject handle to pushbuttonm (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% String s1
s1=str2double(get(handles.listboxm,'String'));
% Value s1
|
|
% , s1
% numberm
numberm=get(handles.listboxm,'Value');
% se
se=str2double(get(handles.editm,'String'));
%
l=length(s1);
% , numberm
%
for i=l+1:-1:numberm+1
s1(i)=s1(i-1);
end
% numberm
%
s1(numberm)=se;
%
% listboxm ( String s1)
set(handles.listboxm,'String',s1);
. 2.42.8 .
MATLAB
:
msgbox('','_','_')
_ : 'none' ; 'warn' ; 'error' ; 'help' .
, , . 2.43.1 ,
msgbox(' !',' ','error')
inputdlg :
inputdlg('','_')
, ; .
inputdlg (. 2.43.2):
. 2.42.8. .
. 2.43.1. .
. 2.43.2. .
. 2.43.3. , questdlg.
>> s=inputdlg({'x=','y='},' x, y');
>> x=num2str(s{1})
x =
>> y=num2str(s{2})
y =
questdlg, :
questdlg('','_','_')
, (Yes, No, Cancel), ( Cancel). . . 2.43.3 , :
>> questdlg(' ',' ','Cancel')
ans =
Cancel
MATLAB uigetfile, :
[file,path]=uigetfile('maska','')
maska , , ; (file) (path).
, . 2.43.4 , :
>> [f,p]=uigetfile('C:\Users\Pavel\Documents\MATLAB\*.*',' ')
f =
Sample_GUI_3.fig
p =
C:\Users\Pavel\Documents\MATLAB\
MATLAB uiputfile, :
. 2.43.4. .
MATLAB uiputfile, :
[file,path]=uiputfile('maska','')
maska , ( ).