How to plot from a line array?
Afficher commentaires plus anciens
I'm indexing several lines in a line array as such:
h(i) = plot(B, sim/max(sim));% i = integer
Is there a function that is sort of the reverse of delete(h(i))?
I'm trying to add certain lines to figures together pulling from an array of several lines.
EDIT:
Basically I am looking for a way to easily replot lines that I have already plotted without having to use the plot() function and set the linewidths and colors, etc. all over again. I have found that indexing my lines in a line array has been helpful for removing certain plots by using delete(h), but I haven't found a way to re-add them onto figures after deleting.
2 commentaires
darova
le 25 Fév 2020
The question is unclear. Can you explain more?
Andrew Boggiano
le 25 Fév 2020
Réponse acceptée
Plus de réponses (1)
darova
le 25 Fév 2020
Here is an example
clc,clear
% create some data with handles
h(1) = plot([0 1],[0 1],'r');
hold on
h(2) = plot([1 3],[1 2],'b');
h(3) = plot([3 4],[2 3],'g');
hold off
% save data fro h(2)
x = get(h(2),'xdata');
y = get(h(2),'ydata');
axis tight
hold on
pause(1)
delete(h(2:3))
pause(1)
plot(x,y)
hold off
Why do you need such function? Can you show your code?
Catégories
En savoir plus sur MATLAB Mobile Fundamentals dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!