Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Program to open .fig files saved by Matlab

Is there any program able to open .fig files saved by Matlab?

like image 852
Cleiton Avatar asked Aug 10 '12 13:08

Cleiton


People also ask

How do I view a .fig file in MATLAB?

I recently noticed that octave will load a fig file as a structure, so if you're stuck with trying to open fig files without being able to access Matlab you could try and write an octave function that will load the fig file and reconstitute the plot from the contents of the struct .

How do I open .fig file?

How to open a FIG file. You can open FIG files in WinFIG, a cross-platform vector graphics editor application. To do so, select File → Open... from WinFIG's menu bar. Then, navigate to and open your FIG file.

How do I open a .fig file in Ubuntu?

Under Ubuntu, if you cannot add a custom command like this: Right click the . fig - file --> "Open with Other Application" --> Use a custom command --> matlab -desktop -r "open(%f)" one can use Ubuntu Tweak for that.


3 Answers

Update 29/04/2016

According to johnml1135's answer, fig files are essentially just mat files, and johnml1135 figured out where the various plot elements are stored, for converting a fig file to a Python plot.

Original

According to the answer here the fig file saved by Matlab is in a proprietary binary format. I don't know of any other software capable of loading this format.

Your best option is probably to have the figure saved as a pdf/png from within Matlab depending on the type of figure.

Possible workaround

I recently noticed that octave will load a fig file as a structure, so if you're stuck with trying to open fig files without being able to access Matlab you could try and write an octave function that will load the fig file and reconstitute the plot from the contents of the struct. This would probably require knowing prior information about the plot though.

like image 137
jmetz Avatar answered Oct 07 '22 18:10

jmetz


As mentioned by @mutzmatron, .fig is not easily opened, but this is mostly due to it being poorly documented (not sure about proprietary aspects...). As can be seen here, there is a simple format to them quite similar to .mat files, which might give you another direction to go in.

I've always been quite fond of plot2svg. It exports Matlab figures (most anyway) to the non-proprietary vector format SVG.

like image 44
Rody Oldenhuis Avatar answered Oct 07 '22 19:10

Rody Oldenhuis


Create a script (for example FigViewer.m) containing simply the command figure and compile it by running

mcc -e -v FigViewer.m

from the Matlab command window. This way you get a platform-dependent application that runs on any computer with the right version of the Matlab Compiler Runtime installed, which is freely available. If you are looking for further information on the Matlab Compiler, use the MathWorks homepage instead of Google since some information is available only behind a login screen and thus cannot be found by Google.

like image 3
Daniel1000 Avatar answered Oct 07 '22 19:10

Daniel1000