Get values from matlab plot
Mostra commenti meno recenti
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 Commenti
Geoff Hayes
il 12 Mag 2020
Arpan - how was the fitted curve added to that plot? Which function or functions were used to create it?
Arpan Bhattacharya
il 12 Mag 2020
Risposte (1)
Ameer Hamza
il 12 Mag 2020
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 Commenti
Arpan Bhattacharya
il 14 Mag 2020
Ameer Hamza
il 14 Mag 2020
It means you have a single line in your figure file.
Arpan Bhattacharya
il 14 Mag 2020
Ameer Hamza
il 14 Mag 2020
What was the issue?
Categorie
Scopri di più su Line Plots in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!