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

조회 수: 261 (최근 30일)
Prasanna
Prasanna 2018년 2월 19일
답변: shubham kumar gupta 2022년 9월 10일
please find the attachment; in the figure, there are two data values. i need the x and y values of this data.

채택된 답변

KSSV
KSSV 2018년 2월 20일
Open the figure:
h = findobj(gca,'Type','line')
x=get(h,'Xdata') ;
y=get(h,'Ydata') ;
(x,y) is your required data.
  댓글 수: 6
Siddhartha Ganguly
Siddhartha Ganguly 2022년 5월 20일
편집: Siddhartha Ganguly 2022년 5월 20일
Hi, how can I extract data andd save as mat file from a figure which has 3 subplots, like this:
Zack Trahem
Zack Trahem 2022년 7월 19일
let say i have y values and need to find the corresponding location, can we find the unspecified location? As an example on figure i want to find the time of the 68.5 m/s ??

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Shahid Abbas
Shahid Abbas 2021년 2월 10일
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');

shubham kumar gupta
shubham kumar gupta 2022년 9월 10일

카테고리

Help CenterFile Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by