Matlab memory error, need solution

I started using Matlab recently to analyze some EEG data we've been collecting in our lab, and I'm able to run our script for averaging ERPs and correcting for artifact rejection/bad channels, but only once. If I run it once, find I need to adjust the parameters, and try to run again, I get the following error messages, and have to reload the program to do anything more:
??? Error using ==> fread Out of memory. Type HELP MEMORY for your options.
Error in ==> eeg_getdatact at 148 data = fread(fid, [EEG.nbchan Inf], 'float32');
Error in ==> eeg_checkset at 658 EEG.data = eeg_getdatact(EEG);
Error in ==> pop_loadset at 193 EEG = eeg_checkset(EEG, 'loaddata');
Error in ==> wop_postarf_resampled_matthias at 26 EEG = pop_loadset('filename', [subject{s} '_be.set'], 'filepath', pathname_read);
One of the RAs in the lab is convinced it's not a computer memory issue due to the fact that it's able to run the process in the first place, but I'm not as convinced (though honestly, being new to the program, it's not as though I have much knowledge to go on for that assumption). In case it's relevant, the computer specs Matlab spits out:
Maximum possible array: 986 MB (1.034e+009 bytes)
Memory available for all arrays: 1542 MB (1.617e+009 bytes)
Memory used by MATLAB: 266 MB (2.792e+008 bytes)
Physical Memory (RAM): 2005 MB (2.102e+009 bytes)
Any tips on how to solve this issue is greatly appreciated!

Answers (1)

The error message means, that the available free RAM is exhausted. Then this is helpful:
  • clear unused variables
  • import the data in single format:
fread(fid, [EEG.nbchan Inf], '*float32');
  • install more memory(!) and run a 64 bit Matlab
  • stop other programs

Categories

Asked:

on 24 Jan 2012

Community Treasure Hunt

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

Start Hunting!