Plot 2 graph in GUI in a axes

4 visualizaciones (últimos 30 días)
le nguyen
le nguyen el 1 de Jun. de 2019
Comentada: dpb el 1 de Jun. de 2019
Hi everyone,
I'm creating a Matlab guide and trying to creat an axes and 2 push button. First, I want to press pushbutton9, a graph will appear, then I press the pushbutton10, i want the second graph will also appear on the axes when the first is still here to compare 2 graph. I'm using the 'hold on' function but whenever I press the pushbutton 10, the first graph disappears. Can anyone help me so this problem?
Thank you so much.
% --- Executes on button press in pushbutton9.
function pushbutton9_Callback(hObject, eventdata, handles)
dataset = xlsread('data.xlsx','Sheet1','A1:B450');
oil = dataset(:,1)
day = dataset(:,2)
plot(handles.axes1,day,oil)
hold on
% --- Executes on button press in pushbutton10.
function pushbutton10_Callback(hObject, eventdata, handles)
data = xlsread('data.xlsx','Sheet1','A2:H450');
day = data(:,2);
oil = data(:,8);
plot(handles.axes1,day, oil,'r')
  1 comentario
dpb
dpb el 1 de Jun. de 2019
Try
  1. hold(handles.axes1,'on') in PB10 code...
  2. Use low-level |line() instead of plot in PB10...

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Creating, Deleting, and Querying Graphics Objects en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by