hello i want make callback function
Afficher commentaires plus anciens
function plotsinorcos
global Am t fr cs S;
N=500;
M=300;
t=[0 : 0.01 : 5];
handles.fig=figure();
mpos=get(handles.fig,'position');
set(handles.fig,'position',[mpos(3) mpos(4) N M]);
set(handles.fig,'units','pixel');
handles.axes=axes();
set(handles.axes,'units','pixel');
handles.edit1=uicontrol('style','edit');
set(handles.edit1,'position',[N-50 0 50 20]);
set(handles.edit1,'string','amplitude');
set(handles.edit1,'horizontalalignment','left');
handles.edit2=uicontrol('style','edit');
set(handles.edit2,'position',[N-120 0 70 20]);
set(handles.edit2,'string','frequency');
set(handles.edit2,'horizontalalignment','left');
handles.edit3=uicontrol('style','edit');
set(handles.edit3,'position',[N-200 0 80 20]);
set(handles.edit3,'string','sin=1,cos=2');
set(handles.edit3,'horizontalalignment','left');
set(handles, 'callback', {@callbcak, handles,Am,fr,S,cs});
function callbcak(gcf, event_data, handles, Am,fr,S,cs)
handles.text1=get(handles.edit1,'string');
handles.text2=get(handles.edit2,'string');
handles.text3=get(handles.edit3,'string');
Am=handles.text1;
fr=handles.text2;
cs=handles.text3;
if cs==1
S=Am*cos(2*pi*fr*t);
elseif cs==2
S=A*cos(2*pi*fr*t);
end
handles.plot1=plot(t,S);
hello! i want cos , sin plot
handles.edit<< i write = amplitude,frequency and cos=1,sin=2
resultingly draw handles.plot1
plz help me..
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur App Building dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!