Replot a matlab.graphics.chart
Afficher commentaires plus anciens
I have a simple issue that I could use some help with. I am preparing a loop where each cycle saves a plot in a matlab.graphics.chart. A simple code example:
x=[2 4 6 8];
y=[10 20 30 40];
plot1=plot(x,y);
How do I re-plot "plot1"? Thanks
7 commentaires
KSSV
le 6 Sep 2017
Why you are worried of replotting? already you have data in hand..use plot again..
JB
le 6 Sep 2017
José-Luis
le 6 Sep 2017
plot(x,y)
You can issue the command as many times as you want.
Or do you mean to get x and y data from an existing plot?
You could also copy graphic objects, but that's a roundabout way to go about things if you do have the data.
JB
le 6 Sep 2017
JB
le 6 Sep 2017
José-Luis
le 6 Sep 2017
When you say generate one plot and store it in a data array, how do you do that?
Please show some example code.
JB
le 6 Sep 2017
Réponse acceptée
Plus de réponses (2)
plot1 is the axis handle. "re-plotting" means plotting on the same figure window with the new data.
for iCount = 1:5
x = iCount*[2 4 6 8];
y = iCount*[10 20 30 40];
h1 = figure(1); %h1 is figure handle
plot1=plot(x,y); %plot1 is axis handle
end
Catégories
En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!