grapg is not activate plz help me
조회 수: 3 (최근 30일)
이전 댓글 표시
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
채택된 답변
Walter Roberson
2015년 12월 3일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Stress and Strain에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!