MATLAB Answers

How to extract x, y data values from matlab figure?

936 views (last 30 days)
Prasanna
Prasanna on 19 Feb 2018
Answered: Shahid Abbas on 10 Feb 2021
please find the attachment; in the figure, there are two data values. i need the x and y values of this data.

Accepted Answer

More Answers (1)

Shahid Abbas
Shahid Abbas on 10 Feb 2021
If you want to get the values of unknown points from the figure and have to use in code then this could be helpful.
delete 2.fig;
savefig('2.fig');
open('2.fig');
h = gcf; %current figure handle
axesObjs = get(h, 'Children'); %axes handles
dataObjs = get(axesObjs, 'Children'); %handles t
xdata = get(dataObjs, 'XData');
ydata = get(dataObjs, 'YData');

Community Treasure Hunt

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

Start Hunting!

Translated by