grapg is not activate plz help me
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
rollcakes
le 3 Déc 2015
Commenté : Walter Roberson
le 4 Déc 2015
function mornig
global A F T;
N=500;
M=300;
handles.fig=figure;
mpos=get(handles.fig,'position');
set(handles.fig,'position',[mpos(3) mpos(4) N M]);
handles.axes=axes();
set(handles.fig,'unit','pixels');
set(handles.axes,'unit','pixels');
handles.edit1=uicontrol('style','edit');
set(handles.edit1,'position',[N-360 0 120 20]);
set(handles.edit1,'string','A');
set(handles.edit1,'horizontalalignment','center');
handles.edit2=uicontrol('style','edit');
set(handles.edit2,'position',[N-240 0 120 20]);
set(handles.edit2,'string','F');
set(handles.edit2,'horizontalalignment','center');
handles.edit3=uicontrol('style','edit');
set(handles.edit3,'position',[N-120 0 120 20]);
set(handles.edit3,'string','T');
set(handles.edit3,'horizontalalignment','center');
set(handles.edit1, 'callback', {@edit_callback1, handles,A});
set(handles.edit2, 'callback', {@edit_callback2, handles,F});
set(handles.edit3, 'callback', {@edit_callback3, handles,T,A,F});
function edit_callback1(gcf, event_data, handles, A)
handles.text1=get(handles.edit1,'string');
A=(handles.text1);
function edit_callback2(gcf, event_data, handles, F)
handles.text2=get(handles.edit2,'string');
F=(handles.text2);
function edit_callback3(gcf, event_data, handles, T, A, F)
handles.text3=get(handles.edit3,'string');
T=(handles.text3);
plot(handles.axes,T,A*cos(2*pi*F*T));
write amplitud , freuency, time
and drawing but activate do not..
help me
0 commentaires
Réponse acceptée
Walter Roberson
le 3 Déc 2015
function mornig
A = 0; F = 0; T = 0; %not global!
N=500;
M=300;
handles.fig=figure;
mpos = get(handles.fig,'position');
set(handles.fig, 'position',[mpos(3) mpos(4) N M]);
handles.axes = axes();
set(handles.fig,'unit','pixels');
set(handles.axes,'unit','pixels');
handles.edit1 = uicontrol('style','edit');
set(handles.edit1,'position',[N-360 0 120 20]);
set(handles.edit1,'string','A');
set(handles.edit1,'horizontalalignment','center');
handles.edit2 = uicontrol('style','edit');
set(handles.edit2,'position',[N-240 0 120 20]);
set(handles.edit2,'string','F');
set(handles.edit2,'horizontalalignment','center');
handles.edit3 = uicontrol('style','edit');
set(handles.edit3,'position',[N-120 0 120 20]);
set(handles.edit3,'string','T');
set(handles.edit3,'horizontalalignment','center');
set(handles.edit1, 'callback', @edit_callback1);
set(handles.edit2, 'callback', @edit_callback2);
set(handles.edit3, 'callback', @edit_callback3);
%now nested functions
function edit_callback1(src, event_data)
A = str2double( get(src, 'String') );
end
function edit_callback2(src, event_data)
F = str2double( get(src, 'String') );
end
function edit_callback3(src, event_data)
T = str2num( get(src, 'String') ); %because it probably is not a scalar
plot(handles.axes, T, A*cos(2*pi*F*T));
end
Note that in order for you to see much, you will need to enter a vector of values for T
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Stress and Strain dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!