java.lang.RuntimeException: IInternalException - error output
5 ビュー (過去 30 日間)
古いコメントを表示
I have code that is generating a movie from a series of binary files. The code has no issue with running until it reaches about 500 of the loaded files. At which point the code stops running, the movie is left incomplete, and I receive the following error message:
Caught "std::exception" Exception message is:
Message Catalog MATLAB:FileIO was not loaded from the file. Please check file location, format or contents
Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: IInternalException for "matlab.desktop.currentfolder.History": Cannot open a temp file to save the Settings object. It could due to out of file handle or other reasons.
at com.mathworks.services.settings.Setting.nativeSet(Native Method)
at com.mathworks.services.settings.Setting.set(Setting.java:900)
at com.mathworks.services.settings.Setting.set(Setting.java:758)
at com.mathworks.services.settings.Setting.set(Setting.java:700)
at com.mathworks.mlwidgets.explorer.model.navigation.NavigationHistory.addCurrentPath(NavigationHistory.java:185)
at com.mathworks.mlwidgets.explorer.model.navigation.NavigationHistory.access$400(NavigationHistory.java:30)
at com.mathworks.mlwidgets.explorer.model.navigation.NavigationHistory$3.navigationChange(NavigationHistory.java:115)
at com.mathworks.mlwidgets.explorer.model.navigation.NavigationContext.setLocation(NavigationContext.java:215)
at com.mathworks.mlwidgets.explorer.model.navigation.NavigationContext.setLocation(NavigationContext.java:175)
at com.mathworks.mde.explorer.Explorer$14.actionPerformed(Explorer.java:887)
at java.awt.AWTEventMulticaster.actionPerformed(Unknown Source)
at com.mathworks.jmi.MatlabPath$DeferredActionEvent.dispatch(MatlabPath.java:170)
at com.mathworks.util.QueueEvent$QueueTarget.processEvent(QueueEvent.java:117)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(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)
I have been unable to find any resolution to this issue via internet searches and I cannot tell if it is an issue with MATLAB itself, java, or something else. For reference, this is my code:
tic
clc
clear
cd('C://folder/');
dirname = 'C://folder/';
files = dir(fullfile(dirname, 'snapshot*'));
numfiles = length(files);
N = 50000; % not including intruder
text = 'plotname, t = '; %specify this according to parameters
label = ['x';'y';'z'];
m = 12; f = 10; r = 1; s = 4;
az = 0; el = 0; % determine the viewing angles
rmax = 10; % specify this according to parameters
timestep = 0.2; % specify this according to parameters
minx = -rmax; % default axes based on rmax. can be changed
maxx = rmax;
miny = -rmax;
maxy = rmax;
posdata = cell(1,numfiles); %allocating cell memory for each frame
x = cell(1,numfiles);
y = cell(1,numfiles);
z = cell(1,numfiles);
cmx = zeros(1,numfiles);
cmy = zeros(1,numfiles);
cmz = zeros(1,numfiles);
partid = cell(1,numfiles);
data = cell(1,numfiles);
scrnsz = get(0,'ScreenSize');
movie = figure('Name','Plot','NumberTitle','off','Position',[(1+0.5*(scrnsz(3)-scrnsz(4))) 1 scrnsz(4) scrnsz(4)]);
movsize = get(movie,'Position');
n = num2str(N/1000);
movtitle = strcat(n,'k_2D.avi');
mov = VideoWriter(movtitle);
mov.FrameRate = s;
open(mov);
for i = 1:numfiles
posdata{i} = zeros(3,N+1); % preallocating matrix space for each file
partid{i} = zeros(1,N+1);
data{i} = zeros(4,N+1);
x{i} = zeros(N+1,1);
y{i} = zeros(N+1,1);
z{i} = zeros(N+1,1);
files(i).name = fopen(files(i).name,'r','n'); % opening and reading all files
fseek(files(i).name,284+4*3*(N+1)*2,'bof');
partid{i} = fread(files(i).name,[1,N+1],'uint32','n');
fseek(files(i).name,264,'bof');
[~,count] = fread(files(i).name,1,'int32'); % skips 4 byte header (reading from unformatted binary)
posdata{i} = fread(files(i).name,[3,N+1],'float32','n'); % read position block
[~,count] = fread(files(i).name,1,'int32'); % skips 4 byte header (reading from unformatted binary)
data{i} = vertcat(posdata{i},partid{i});
data{i} = data{i}';
data{i} = sortrows(data{i},4); % sort by particle id
posdata{i} = posdata{i}';
x{i} = data{i}(1:N+1,1);
y{i} = data{i}(1:N+1,2);
z{i} = data{i}(1:N+1,3);
cmx(1,i) = mean(x{i}(2:N+1,1)); % center of mass not including intruder
cmy(1,i) = mean(y{i}(2:N+1,1));
cmz(1,i) = mean(z{i}(2:N+1,1));
plot3(x{i},y{i},z{i},'.k','MarkerSize',r);
grid off
axis([-20 20 -20 20])
axis xy
xlabel(label(1,:),'FontSize',f)
ylabel(label(2,:),'FontSize',f)
zlabel(label(3,:),'FontSize',f)
[ftitle, errmsg] = sprintf('%s%s',text(1,:),num2str((i-1.0).*timestep, '%.1f'));%time counter
title(ftitle,'FontSize',f)
M = getframe(movie);
writeVideo(mov,M);
end;
cd(dirname);
close(mov);
close(movie);
toc
0 件のコメント
採用された回答
Walter Roberson
2015 年 8 月 27 日
You are running out of file handles. Your operating system has been configured for a maximum number of simultaneously open files per process, and you are exceeding that limit. You should fclose() each file after you are finished reading from it.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Entering Commands についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!