Initializing Axes title and Xlim - GUI
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I have the program below, How can I set the Xlabel and Xlim before the push button is executed (initializing). I want to see the xlabel when the program is run and it should no be modified by any callbacks. The program below does this but I have to repeat the X-label several times:
if true
% code
function mygui3
%creating figure
f = figure('visible','on','Position',[350,100,650,400],'color', [0.25,0.83,0.83]);
t1_axes = axes('units','pixels','Position',[100,250,400,75]);
title('first graph');
xlabel('time');
ylabel('data');
t2_axes = axes('units','pixels','Position',[100,50,400,75]);
%creating uicontrol
i_button1 = uicontrol('Style','pushbutton',...
'string','err',...
'Position',[550,100,50,20],...
'callback',{@b1_callback});
end
if true
i_button2 = uicontrol('style', 'pushbutton',...
'Position',[550,150,50,20],...
'backgroundcolor',[0.35,0.76,0.25],...
'callback',{@b2_callback});
i_button3 = uicontrol('style','pushbutton',...
'string','clear all',...
'Position',[550,200,50,20],...
'callback',{@b3_callback});
%initialized the GUI
set(i_button1,'string','sin(x)');
set(i_button2,'string','sin(x2)');
%programing uicontrol
function b1_callback(hObject,eventdata)
axes(t1_axes);
x = 0:0.01:2*pi;
plot(x,sin(x));
title('first graph');
xlabel('time');
ylabel('data');
set(t1_axes, 'XLim',[0 2*pi]);
set(t1_axes, 'YLim',[-1 1]);
end
function b2_callback(hObject,eventdata)
axes(t2_axes);
x=0:0.01:2*pi;
plot(x,sin(2*x));
title('first graph');
xlabel('time');
ylabel('data');
set(gca, 'XLim',[0 2*pi]);
set(gca, 'YLim',[-1 1]);
end
function b3_callback(hObject,eventdata)
cla(t1_axes,'reset');
cla(t2_axes,'reset');
end
end
end
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!