hello i want make callback function

2 次查看(过去 30 天)
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..

采纳的回答

Image Analyst
Image Analyst 2015-12-4
Why not make it easy on yourself? Use GUIDE so that you don't have to build a complete user interface from tedious and detail very low level routines. Get started with MAGIC, a nice framework that will get you started.
Description
This GUI will help the novice user get up to speed very quickly on using GUI-based applications. Everything is laid out in a very simple Step 1, Step 2, Step 3, etc. layout. It is a very good starting point for a typical application. This application uses GUIDE to do the user interface design, and has most of the basic controls such as buttons, listboxes, checkboxes, radio buttons, scrollbars, etc. It allows the user to select a folder of images, select one or more images and display them, to select a series of options, and to individually or batch process one or more images. The user can..............

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by