Saving .fig file from Octave

丶灬走出姿态 提交于 2019-12-07 01:34:28

问题


I need to make a .fig file that can be reopened in Matlab, but I am working in Octave. But apparently there is no saveas command in Octave. This is what I am trying:

octave:3> plot([1,2,3],[45,23,10])
octave:4> saveas(gcf,'myfig.fig')
error: `saveas' undefined near line 4 column 1
octave:4> 

回答1:


Currently the Matlab fig file format is a proprietary binary file format.

Octave doesn't know how to export to this format and won't be able to until it is reverse engineered. The fig format that Octave knows about is a different fig format used by Xfig with the same extension name, but nothing else in common.

To export the plot to other formats in octave use the print command E.g print -deps myplot.eps or print -dpng myplot.png .

Of course this doesn't let you open the plot for editing in Matlab , though you can open the image generated using imread.

There was a project to read Matlab fig files in Octave located here but the relevant .m file doesn't seem to be archived successfully.

If you found a copy of that m file and it successfully read Matlab fig files in Octave you could use it to make an Octave script that wrote fig files from Octave.

Alternatvely you can use the save command to save the matrix / raw data load into a Matlab .mat file or other file format, then load that in Matlab and replot it with Matlab.



来源:https://stackoverflow.com/questions/9269195/saving-fig-file-from-octave

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!