Array problem
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hey every1, I am actually having trouble with arrays!! I have my plot and is underneath and it is not saved in array at the moment but I would like to story it in array so I should have a value for[x1,y1] in an array.. the question is how can I get the values of the plots and store it in an array???
x = linspace(min(Sa),max(Sa),100);
y = pchip(Sa,lambda(Sa),X);
plot(x,y)
a [x,y] then is it by looping through it and if it is how can we say then the next value in x and y.. I want to store each pair value(x,y) of the plot in an array???
Your help will be appreciated!
Akzeptierte Antwort
Paulo Silva
am 26 Jul. 2011
SusanArray=[x;y]; %2 rows, first row is x and second is y
%each column is a pair of values
Weitere Antworten (2)
Walter Roberson
am 26 Jul. 2011
h = find(gca,'type','line');
xd = get(h, 'XData');
yd = get(h, 'YData');
7 Kommentare
Nathan Greco
am 26 Jul. 2011
And he corrected his "find..." line to be "findobj..." within the comments.
Susan
am 26 Jul. 2011
4 Kommentare
Nathan Greco
am 26 Jul. 2011
Are they not already stored in arrays? If I'm not mistaken, that is exactly what your original x and y arrays are. If you wanted them in one array, just concatenate them together as Paulo answered. If you wanted to retrieve that same data from the plot (why? I don't know), follow Walter's method, replacing his "h = find(gca,'type','line');" with "h = findobj(gca,'type','line');". If this doesn't work for you, please say why not.
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!