plotting two curve in one axes
Mostrar comentarios más antiguos
Hi all; I have to plot two functions in same axes these functions in two different pushbutton functions, the code so far is as follow:
- function pushbutton1_Callback(hObject, eventdata, handles)
x = [31 32 32 33 34 35 35 37 37]; % data 1
y = [0 3 11 29 53 80 98 126 150]; % maximum power
plot(handles.axes,x,y)
- function pushbutton2_Callback(hObject, eventdata, handles)
x = [31 32 32 33 34 35 35 37 37]; % data 1
y1=y*0.7; % actual power
plot(handles.axes,x,y1)
the problem that i am facing is when plotting the second function the first is disappear. how to overcome this issue ?? please help and advice.
Sam
Respuesta aceptada
Más respuestas (2)
Azzi Abdelmalek
el 18 de Sept. de 2012
hold on;
plot(handles.axes,x,y1)
10 comentarios
Samer Husam
el 18 de Sept. de 2012
Azzi Abdelmalek
el 18 de Sept. de 2012
Editada: Azzi Abdelmalek
el 18 de Sept. de 2012
what is the name of your axes object, by default it's axes1, have you changed it? if not then
hold on;
plot(handles.axes1,x,y1)
have you any error message?
Samer Husam
el 19 de Sept. de 2012
Azzi Abdelmalek
el 19 de Sept. de 2012
post the full code of your function (the one involved with plot)
Samer Husam
el 20 de Sept. de 2012
Azzi Abdelmalek
el 20 de Sept. de 2012
You said a full code. What are y and x in function 2. Not defined
Samer Husam
el 20 de Sept. de 2012
Azzi Abdelmalek
el 20 de Sept. de 2012
Editada: Azzi Abdelmalek
el 20 de Sept. de 2012
You said it s a full code but in your second function there is no xlsread
Samer Husam
el 20 de Sept. de 2012
Azzi Abdelmalek
el 20 de Sept. de 2012
to find the problem, it's usefull to read the full code, at least of functions that are involved. Because there is no problem with
hold on;
plot(handles.axes,x,y1)
I did it and it works
Jürgen
el 18 de Sept. de 2012
0 votos
use the hold function
hold on for example will help
regardsJ
Categorías
Más información sobre Data Exploration en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!