Extract Data From a Matlab .fig File

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

It turns out that extracting data from an existing matlab, figure (.fig) file is very simple.Follow the steps listed below:

s=hgload('filename.fig');
h = findobj(s,'Type','line');
y=get(h,'ydata');
x=get(h,'xdata');

Replace filename.fig with the appropriate name for your fig file. If your figure file has multiple lines, you might need to be carefully with second command, to be sure of the line that gets selected. I simply saved each curve in a separate fig file to avoid any issues. If your fig file doesn’t have ‘lines’, then replace the ‘line’ tag with appropriate type, e.g. for scatter plot ‘hggroup’, might work.

You might also like

Outwit – An extremely useful firefox extension to harvest data from websites! Couple of days...
Cheap DIY esata Enclosure Hack for 2.5″ Laptop SATA Drive If your laptop...
Adblock for Opera (Blocking ads in Opera on Windows/Linux) Opera is a...
Extract Audio From Youtube HD MP4 Video Files What if you...

About the Author

has written 346 posts on this blog.

Meditating towards his "nerdvana", lifehacker is a teacher by the day and a nerdy blogger by the night. He lives to learn and yearns to learn living.

Write a Comment

Gravatars are small images that can show your personality. You can get your gravatar for free today!

*

Copyright © 2019 Hack Your Life!. All rights reserved.
Proudly powered by WordPress. Developed by Deluxe Themes