Is it possible to automate the plotting of data that is created by multiple passes of the same script?
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
For example the script runs once and creates a set of data, then runs again (overwriting previous data). I need all data on same plot.
I can save each plot separately and then reassemble once all plots are created, however a simpler way would be preferred so all that would have to be done is running the program and all data would go to the same plot without being overwritten.
1 Commento
Adam
il 26 Ott 2015
Just change your script into a function and do the plotting in a script or function that then calls it multiple times.
You could probably still do that with a script, but depending what is in the script it may be more complicated. Functions are generally better than scripts, especially if you want to do the same thing repeatedly, but with different data.
Risposta accettata
Jan
il 26 Ott 2015
Create the axes object with enabling the adding of new lines:
AxesH = axes('NextPlot', 'add', 'Tag', 'ThisIsMyFixedAxes');
When the script runs the next time, it does not create the axes, if it is existing already:
AxesH = findobj('Tag', 'ThisIsMyFixedAxes')
if isempty(AxesH)
AxesH = axes('NextPlot', 'add', 'Tag', 'ThisIsMyFixedAxes');
else
axes(AxesH); % Make it the current axes object
end
Instead of axes(AxesH) it would be smarter to add the axes' handle as a parent in the plot command:
plot(1:10, rand(1, 10), 'Parent', AxesH);
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Annotations in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!