How can I avoid java.io.FileNotFoundException for temp files after multiple xlsread/xlswrite operations?
Ältere Kommentare anzeigen
I'm running simulations that require multiple write and read interactions with Excel in each iteration. I use xlsread and xlswrite to perform these read/write operations.
After a number of iterations, I start getting a java.io.FileNotFoundException for .tmp files (example included below). The program execution is not stopped, but sometimes there are corrupt values in the output that seem to be caused by this problem.
Since the problem only occurs after running the simulations for a while and becomes more frequent over time, I think it might be due to a memory leak of some sort. So I'd like to perform a cleanup after each iteration, and start the Excel interaction in the next iteration with a clean slate. Any ideas on how I could achieve this?
I've already tried using fclose('all') after each iteration, but this didn't help.
Matlab version: R2012b
Excel version: MS Office Excel 2007
FileSystemView.getShellFolder: f=H:\MATLAB\EC3BF813.tmp
java.io.FileNotFoundException: File H:\MATLAB\EC3BF813.tmp not found
at sun.awt.shell.Win32ShellFolderManager2.createShellFolder(Unknown Source)
at sun.awt.shell.Win32ShellFolderManager2.createShellFolder(Unknown Source)
at sun.awt.shell.ShellFolder.getShellFolder(Unknown Source)
at javax.swing.filechooser.FileSystemView.getShellFolder(Unknown Source)
at javax.swing.filechooser.FileSystemView.getSystemIcon(Unknown Source)
at com.mathworks.jmi.MLFileIconUtils.getNativeFileIcon(MLFileIconUtils.java:242)
at com.mathworks.jmi.MLFileIconUtils.getFileIcon(MLFileIconUtils.java:102)
at com.mathworks.mlwidgets.explorer.extensions.basic.DefaultFileInfoProvider$1.run(DefaultFileInfoProvider.java:64)
at com.mathworks.mlwidgets.explorer.model.FileDecorationModel$DeferHandler.run(FileDecorationModel.java:390)
at com.mathworks.mlwidgets.explorer.model.FileDecorationModel$2.get(FileDecorationModel.java:275)
at com.mathworks.mlwidgets.explorer.util.UiFileSystemUtils.getDecorationSynchronously(UiFileSystemUtils.java:125)
at com.mathworks.mlwidgets.explorer.util.UiFileSystemUtils.getDecorationSynchronously(UiFileSystemUtils.java:98)
at com.mathworks.mlwidgets.explorer.model.table.FileSystemExpansionProvider.getDecoration(FileSystemExpansionProvider.java:124)
at com.mathworks.mlwidgets.explorer.model.table.FileSystemExpansionProvider.getDecoration(FileSystemExpansionProvider.java:129)
at com.mathworks.mlwidgets.explorer.model.table.IconColumn$1.convert(IconColumn.java:38)
at com.mathworks.mlwidgets.explorer.model.table.IconColumn$1.convert(IconColumn.java:35)
at com.mathworks.widgets.grouptable.GroupingTableColumn.getValue(GroupingTableColumn.java:141)
at com.mathworks.widgets.grouptable.GroupingTableRow.getValueAt(GroupingTableRow.java:474)
at com.jidesoft.grid.TreeTableModel.getValueAt(Unknown Source)
at javax.swing.JTable.getValueAt(Unknown Source)
at com.jidesoft.grid.CellSpanTable.getValueAt(Unknown Source)
at com.jidesoft.grid.JideTable.prepareRenderer(Unknown Source)
at com.jidesoft.grid.CellStyleTable.prepareRenderer(Unknown Source)
at com.mathworks.widgets.grouptable.GroupingTableUIDelegate.paintCell(GroupingTableUIDelegate.java:66)
at com.mathworks.widgets.grouptable.GroupingTableUIDelegate.paintSpanCells(GroupingTableUIDelegate.java:373)
at com.mathworks.widgets.grouptable.GroupingTableUIDelegate.paint(GroupingTableUIDelegate.java:141)
at com.jidesoft.plaf.basic.BasicCellSpanTableUI.paint(Unknown Source)
at javax.swing.plaf.ComponentUI.update(Unknown Source)
at javax.swing.JComponent.paintComponent(Unknown Source)
at com.jidesoft.grid.CellStyleTable.paintComponent(Unknown Source)
at com.mathworks.widgets.grouptable.GroupingTable.paintComponent(GroupingTable.java:267)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JViewport.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintToOffscreen(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
at javax.swing.RepaintManager.paint(Unknown Source)
at javax.swing.JComponent._paintImmediately(Unknown Source)
at javax.swing.JComponent.paintImmediately(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Spreadsheets finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!