Save figure with java graphic object

Is there a way how to save a figure to a *.fig file with all included java objects? When you add a java object to a matlab figure (e.g. http://www.mathworks.com/matlabcentral/fileexchange/30403-thermometer-demo) and then you save the figure and reopen it only the matlab objects are in.

 채택된 답변

Malcolm Lidierth
Malcolm Lidierth 2012년 1월 26일

0 개 추천

Any Java objects would needs to be fully serializable. See Saving and Loading Java Objects to MAT-Files in the MATLAB docs (note that fig files are mat files).
Swing objects all carry the following caveat in the javadoc.
Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see XMLEncoder.

댓글 수: 4

Sven Koerner
Sven Koerner 2012년 1월 26일
Hi Malcom, thanks for your anwser. Maybe the jfreechart object isn't fully serializable. I guess that it works with your GSplitPane function, however Matlab warns ... the pane isn'f fully serializable.
Do you know an alternative tool for creating SplitPane wich is fully serializable?
Regards, Sven
Malcolm Lidierth
Malcolm Lidierth 2012년 1월 27일
A JSplitPane can be saved but not necessarily its contents. The problem components would need to be extended in Java and a custom write/readObject added or the problem properties would need to be declared as transient.
Malcolm Lidierth
Malcolm Lidierth 2012년 1월 27일
PS Early days but the next installment of Waterloo will be a 2D scientific graphics library written entirely in Java. That will allow saving (I hope) and a "pre-release" should be available in the next month or two. It is also highly interactive so axes etc can be dragged and set using the mouse and there is a MATLAB interface providing support for MATLAB style calls like line, scatter contour etc.
Sven Koerner
Sven Koerner 2012년 2월 3일
Thanks Malcom for reply. I'm looking forward to next waterloo-version.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Type Identification에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by