Get values from matlab plot

57 ビュー (過去 30 日間)
Arpan Bhattacharya
Arpan Bhattacharya 2020 年 5 月 12 日
コメント済み: Ameer Hamza 2020 年 5 月 14 日
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
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
Arpan Bhattacharya 2020 年 5 月 12 日
Hi Geoff,
Its from a matlab based software. I usedan exponential equation to fit my data. The only thing is I can save the fitted curve as matlab figure (.fig format). Is that what you are asking?

サインインしてコメントする。

回答 (1 件)

Ameer Hamza
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
Arpan Bhattacharya 2020 年 5 月 14 日
Thanks. I got this working.
Ameer Hamza
Ameer Hamza 2020 年 5 月 14 日
What was the issue?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeFit Postprocessing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by