I have this error messege when saving a figure

When I try to save a figure, the follwoing messege appears in the command window, and it does not save the figure. Why?
The messege:
??? Java exception occurred: java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 4
at java.util.Vector.get(Unknown Source)
at javax.swing.plaf.basic.BasicDirectoryModel.getElementAt(Unknown Source)
at javax.swing.plaf.basic.BasicListUI.updateLayoutState(Unknown Source)
at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(Unknown Source)
at javax.swing.plaf.basic.BasicListUI.getCellBounds(Unknown Source)
at javax.swing.JList.getCellBounds(Unknown Source)
at javax.swing.JList.ensureIndexIsVisible(Unknown Source)
at sun.swing.FilePane.ensureIndexIsVisible(Unknown Source)
at sun.swing.FilePane.ensureFileIsVisible(Unknown Source)
at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.ensureFileIsVisible(Unknown Source)
at javax.swing.JFileChooser.ensureFileIsVisible(Unknown Source)
at javax.swing.JFileChooser.setSelectedFile(Unknown Source)
at com.mathworks.mwswing.MJFileChooserPerPlatform.setSelectedFile(MJFileChooserPerPlatform.java:377)
Error in ==> AbstractFileDialog.AbstractFileDialog>AbstractFileDialog.setPeerCurrentFile at 172 obj.Peer.setSelectedFile(java.io.File([aPathName, filesep], aFileName));
Error in ==> UiFileSaveDialog.UiFileSaveDialog>UiFileSaveDialog.show at 30 setPeerCurrentFile(obj);
Error in ==> uitools\private\uigetputfile_helper at 46 ufd.show();
Error in ==> uiputfile at 110 [filename, pathname, filterindex] = uigetputfile_helper(1, varargin{:});
Error in ==> filemenufcn>localSaveExport at 284 [newfile, newpath, typevalue] = uiputfile(filter, 'Save As',filename);
Error in ==> filemenufcn at 55 localSaveExport(hfig)
??? Error using ==> filemenufcn(gcbf,'FileSaveAs') Java exception occurred: java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 4
at java.util.Vector.get(Unknown Source)
at javax.swing.plaf.basic.BasicDirectoryModel.getElementAt(Unknown Source)
at javax.swing.plaf.basic.BasicListUI.updateLayoutState(Unknown Source)
at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(Unknown Source)
at javax.swing.plaf.basic.BasicListUI.getCellBounds(Unknown Source)
at javax.swing.JList.getCellBounds(Unknown Source)
at javax.swing.JList.ensureIndexIsVisible(Unknown Source)
at sun.swing.FilePane.ensureIndexIsVisible(Unknown Source)
at sun.swing.FilePane.ensureFileIsVisible(Unknown Source)
at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.ensureFileIsVisible(Unknown Source)
at javax.swing.JFileChooser.ensureFileIsVisible(Unknown Source)
at javax.swing.JFileChooser.setSelectedFile(Unknown Source)
at com.mathworks.mwswing.MJFileChooserPerPlatform.setSelectedFile(MJFileChooserPerPlatform.java:377)
??? Error while evaluating uimenu Callback
Thanks in advance

4 comentarios

Walter Roberson
Walter Roberson el 31 de Dic. de 2011
The single most likely problem is if the version of Java installed does not match what MATLAB expects. Java is temperamental.
You might want to experiment with changing the figure Renderer property.
Saed
Saed el 31 de Dic. de 2011
How?
Saed
Saed el 31 de Dic. de 2011
Ok, I update the java on my computer, and now it is working just fine. Thanks
Saed
Saed el 31 de Dic. de 2011
Oh Oh, it is back gain!!

Iniciar sesión para comentar.

Respuestas (5)

clear all
A=imread('ngc6543a.jpg');
for i=1:5
imwrite(A,['grafica',num2str(i),'.tif']);
end

3 comentarios

Saed
Saed el 31 de Dic. de 2011
What does this segment do? and where to write it?
Image Analyst
Image Analyst el 1 de En. de 2012
Don't worry about it. You already had said that you solved your problem by updating Java.
Jan
Jan el 1 de En. de 2012
@Jose: What are you talking about?

Iniciar sesión para comentar.

copy and paste it into the matlab command window.
and see what this code.
Jose Jeremias Caballero
Jose Jeremias Caballero el 1 de En. de 2012

0 votos

Look at the current directory where to store the files created by the user. there should appear a number of figures created.

1 comentario

Saed
Saed el 1 de En. de 2012
What are these figures? and how these can help solving the problem?
Thanks

Iniciar sesión para comentar.

Image Analyst
Image Analyst el 1 de En. de 2012

0 votos

Saeed: Are you still having the Java problem? Or do you just want to save files? See the FAQ http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F

4 comentarios

Saed
Saed el 1 de En. de 2012
When I press "save as..", the message in the first post appear again, and I can not save the file.
Image Analyst
Image Analyst el 1 de En. de 2012
Call the Mathworks. Apparently it's some kind of Java incompatibility.
Saed
Saed el 4 de En. de 2012
can not I save it from the command window or something like that?
You can try print() or saveas()

Iniciar sesión para comentar.

Categorías

Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 31 de Dic. de 2011

Community Treasure Hunt

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

Start Hunting!

Translated by