Matlab loading slowdown in loop

75 views Asked by At

After a long time searching for an answer and not having found one, my last resort is asking a new question. I create multiple (N=1000) -mat v-6 files that are each about 100 MB in size and contain a single matrix. In a separate part of my code, I need to load in each file. The problem I'm running into is that loading the files in suddenly becomes very time consuming around file number 600 and I'm not sure why its happening. Thanks in advance for any suggestions.

I'm using Matlab R2014b on a Mac with 16GB of ram.

Sample code

c=nan(1,1000)
for h=1:1000 
    tic
    filename=[basefilename,'_',num2str(h),'.mat'];
    transition=load(filename,'P')
    c(h)=toc;
end

Here is an image of the recorded loading times using the exact code above

0

There are 0 answers