hello i want make callback function

3 views (last 30 days)
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..

Accepted Answer

Image Analyst
Image Analyst on 4 Dec 2015
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..............

More Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!