I am experiencing a progressive slowing down of Matlab (r2010a on Windows 7 Pro x64) when loading variables form mat files.
I have a loop where I load a structure on each iteration. The variables are not too big (approx 2Mb). I find it gets slower loading the variables with each iteration, to the point where i have to terminate and restart the session.
I have used tic/toc to time how long it takes to load the files on each iterations. The time to load increases considerably:
Iteration Size (Mb) Time to load (s)
1 2.2201 6.7984
2 2.2541 9.5072
3 1.9966 12.5465
4 2.2100 11.5915
5 2.2003 18.5795
6 2.1955 15.7271
7 2.0191 14.071
8 2.1719 638.1973
9 2.0433 789.7458
I have loaded field iteratively (usually much larger ones than this) without experiencing this problem. I have restarted my computer a number of times (including a hard reset) and it has not helped. I am experiencing it on a number of scripts that load variables iteratively and it only started recently. I am at a loss as to how to fix this.
Any help you can offer would be appreciated.
Thanks
Mark
Any help that can be offered would be appreciated.
Many thanks
Mark
Can you post the part of your code that you are using to load the files?
Best.
Here is a simplified version of the loop I have been running. All i am doing on this version is loading the variables and then clearing them. Even on this version I still suffer the same problem.
Another thing I've noticed it only seems to effect structure variables. Double, single, etc.. variables seem to be OK.
Many thanks
Mark
------------------
load subj_params.mat subjcode eventcode
start_subj=[2:3 5:8 10:16];
selecttrials=[{1} {[2 3]} {[]} {[]} {5}];
for subj=start_subj;
subj
cd('..');
cd(subjcode(subj,:));
for event=[1 2 5]
v_name=[subjcode(subj,:) eventcode(event,:)];
load(['mne_pow_' v_name '.mat'],'source2'); % this is where the problem starts
clear source2
end
end
Try –v6 format if it is faster.
Kirill
Thanks for the advice, Kirill. Just re-saved my .mat files as v6 and it have improved the performance of my scripts substantially with no inexplicable slowing down.
Thanks very much!
Mark