how to extract large number of data points from 2D plot
Afficher commentaires plus anciens
I want to extract large number of data points, like 30000 data ponits or more from 2d plot. Is it possible in matlab ?How to do it ?. These points will be used for other purpose but not for plotting. Thats why want large number of data points .
Réponses (4)
If you can reproduce the figure, just save the coordinates in addition to plotting them,
plot(x,y,'o')
save('coordinates.mat','x','y')
If you only have the .fig file and need to extract the coordinates, open the file so it's the current figure,
fig = gcf();
ax = gca(fig);
chil = ax.Children;
x = get(chil,'XData');
y = get(chil,'YData');
z = get(chil,'ZData');
x,y,z, will be vectors if only 1 set of data are plotted on the axes. If more than 1 object is plotted, x,y,z will be a n*1 cell array for n objects.
Ameer Hamza
le 12 Sep 2020
0 votes
If instead of a fig file, you have an image, you can use this package to extract the data points: https://www.mathworks.com/matlabcentral/fileexchange/7173-grabit
5 commentaires
Aiden James
le 16 Sep 2020
Ameer Hamza
le 16 Sep 2020
Can you show the image?
Adam Danz
le 16 Sep 2020
Have you tried Ameer's suggestion? If you're pulling that fig from a pdf or some other resource that you can zoom into, you'll get better results by making the image larger and increasing its resolution.
Aiden James
le 16 Sep 2020
Adam Danz
le 16 Sep 2020
I haven't used that function but if it doesn't allow the user to specify the sampling rate, you can certainly interpolate the values it extracts.
Aiden James
le 16 Sep 2020
0 votes
Aiden James
le 16 Sep 2020
0 votes
Catégories
En savoir plus sur Line Plots 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!

