.


:




:

































 

 

 

 


MATLAB




.

, . -

. 2.40.7. .

. 2.40.8. Align Objects.

. 2.40.9. , .

. 2.40.10. , .

( , , ), ( ) ( , ).

:

1) (), ();

2) (), a=, b=, c= , ;

3) , , , .

, . 2.41.1.

. 2.41.1. .

MATLAB . set. , (Inspector) (), . Property Inspector, . , . 2.41.2.

, .

, Tag () ( text1, text2, (); edit1, edit2, ( ); pushbutton1, pushbutton2, ().

String, , , . Visible, ( on) ( off).

Position. Position [xleft,ybottom,width,height], xleft ybottom -

; width ; height ( ). Position [xleft,ybottom,width,height], xleft, ybottom, width height (.. 1, (0,0)).

Position. Position [xleft,ybottom,width,height], xleft ybottom ; width ; height ( ). Position [xleft,ybottom,width,height], xleft, ybottom, width height (.. 1, (0,0)).

, 2.41.1, 2.41.2, , . 2.41.3 (, ( ), 16.0; , 14.0)).

2.41.1. ().

Tag text_a text_b text_c text_solve
String a= b= c=  
Visible on On on on

2.41.2. ( , ).

Tag edit_a edit_b edit_c pushbutton_solve
String      
Visible on On on on

. 2.41.2. .

. 2.41.3. .

. 2.41.4. .

Run Run: Sample_GUI ( Sample_GUI.fig , , , (, .fig ; , , .m .. Sample_GUI.m - ( ) . (. 2.41.4), , , . , , , , .. . GUI , Callback, GUIDE .

, Sample_GUI.m , Callback ( MATLAB ). Pushbutton_Solve_Callback:

% --- Executes on button press in pushbutton_solve.

function pushbutton_solve_Callback(hObject, eventdata, handles)

% hObject handle to pushbutton_solve (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

, , ( , - MATLAB name_event, name , event , .. , , name_event). , hObject , ( , handles () . , handles.name, name Tag .

( - ) , , ViewCallbacks, (Callback).

, Pushbutton_Solve_Callback, :

1) text_a, text_b text_c a, b c.

2) () , .

3) () textSolve.

.

% --- Executes on button press in pushbutton_solve.

function pushbutton_solve_Callback(hObject, eventdata, handles)

% hObject handle to pushbutton_solve (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% 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'));

% edit_c ,

% c

c=str2double(get(handles.edit_c,'String'));

if a==0

%

x=-c/b;

%

S=sprintf('X=%g\t',x);

else

d=b*b-4*a*c

if d<0

%

%

S=' ';

else

%

x1=(-b+sqrt(d))/(2*a);

x2=(-b-sqrt(d))/(2*a);

%

S=sprintf('X1=%g\t X2=%g',x1,x2);

end

end

% handles.textSolve String

% S, S

% handles.textSolve

set(handles.textSolve,'String',S);

, a, b c, , , . 2.41.5.

. 2.41.5. .

, , , : , , - .





:


: 2016-12-06; !; : 1834 |


:

:

, .
==> ...

816 - | 656 -


© 2015-2024 lektsii.org - -

: 0.03 .