Plot 2 graph in GUI in a axes

5 vues (au cours des 30 derniers jours)
le nguyen
le nguyen le 1 Juin 2019
Commenté : dpb le 1 Juin 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 commentaire
dpb
dpb le 1 Juin 2019
Try
  1. hold(handles.axes1,'on') in PB10 code...
  2. Use low-level |line() instead of plot in PB10...

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by