Is there any program able to open .fig files saved by Matlab?
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.
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.
plot2svg
once and found it a bit buggy - but I was mostly wondering what the pros and cons are to svg over pdf? –
Euphemie 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.
Python through SciPy has the ability to open a fig file (scipy.io.loadmat), which is really just a mat file by another name. This post can show simple line plots with labels, etc. but can easily be extended. It is fairly straightforward to grab the data from it as well.
As it turns out, there is actually a command in matlab itself that lets you save any figures you want to file in whatever format. Try this:
print('theNameYouWant','-dpng')
This lets you save the figure to a png file which can then be opened by numerous applications like MS Paint or Paintbrush on Mac
© 2022 - 2024 — McMap. All rights reserved.