Info

This question is closed. Reopen it to edit or answer.

I have a .fig file, and I want to print the (x,y) points from the graph in it into a text file- how can I do this? (pictures attached)

1 view (last 30 days)
I have used:
open('C:\Users\jce\Desktop\untitled.fig')
y=get(findobj(get(gca,'Children'),'type','line'),'ydata');
y=get(findobj(get(gca,'Children'),'type','line'),'ydata')
h=findobj(f,'type','line');
xd=get(h,'xdata');
yd=get(h,'ydata');
yd =
[ 36]
[1x2201 double]
xd =
[ 16]
[1x2201 double]
plot(xd{2},yd{2}) % the {2} because {1} consists of a single number
This gives me the plot in wrongdata.jpg, which is blatantly incorrect. One thing that might complicate this is that the data plotted comes from an object.
Any advice/tips?
  2 Comments
dpb
dpb on 16 Jun 2015
Not having the .fig file to fiddle with can't really say much but somewhere in there is the actual data, I'm sure.
dpb
dpb on 17 Jun 2015
Attach the .fig file itself and somebody can probably work it out; w/o it there's really just not enough information to know what the details are within the figure; too many possible ways for it to have been created.

Answers (0)

Tags

Products

Community Treasure Hunt

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

Start Hunting!