Get values from matlab plot
이전 댓글 표시
I have a matlab figure with my real data and a fitted curve on that data. Can I extract the fitted values from that matlab figure?
댓글 수: 2
Geoff Hayes
2020년 5월 12일
Arpan - how was the fitted curve added to that plot? Which function or functions were used to create it?
Arpan Bhattacharya
2020년 5월 12일
답변 (1개)
Ameer Hamza
2020년 5월 12일
If it contains a single line, then you can do something like this
fig = openfig('test.fig');
Line = findobj(fig, 'type', 'line');
x = Line.XData; % x-data
y = Line.XData; % y-data
If there are multiple lines, then the variable 'Line' will be an array. In that case, you can index into 'Line' to get data for a specific line. For example
x = Line(2).XData; % x-data
y = Line(2).XData; % y-data
this code access the 2nd line in array 'Line'
댓글 수: 4
Arpan Bhattacharya
2020년 5월 14일
Ameer Hamza
2020년 5월 14일
It means you have a single line in your figure file.
Arpan Bhattacharya
2020년 5월 14일
Ameer Hamza
2020년 5월 14일
What was the issue?
카테고리
도움말 센터 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!