Deleting data from a graphics

2 vues (au cours des 30 derniers jours)
ali veli
ali veli le 18 Avr 2019
Commenté : ali veli le 18 Avr 2019
Hi all,
I have two variables,x and y.
There are 100 data in these variables,plotting graphics with plot function
After manually deleting some data in the chart, the number of data automatically decreases to 100 in x and y.
How can I save the current data back to the workspace section after deleting it?
Thank you
  2 commentaires
Rik
Rik le 18 Avr 2019
I am not aware you can delete points that way, but the XData and YData properties of the line object (which is returned by the plot function) should contain your data.
ali veli
ali veli le 18 Avr 2019
select data from the graph and press del to manually delete

Connectez-vous pour commenter.

Réponse acceptée

KSSV
KSSV le 18 Avr 2019
x = rand(10,1) ; y = rand(10,1) ;
figure
hold on
for i = 1:10
h = plot(x(i),y(i),'.r') ;
end
title('delete some poits and press any key')
pause
%% Get data
a = get(gca,'Children');
xdata = get(a, 'XData');
ydata = get(a, 'YData');
zdata = get(a, 'ZData');
xdata = cell2mat(xdata) ;
ydata = cell2mat(ydata) ;
plot(xdata,ydata,'Ob')
  1 commentaire
ali veli
ali veli le 18 Avr 2019
Thank you KSSV

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by