As I explained in my last question ( http://www.experts-exchange.com/Programming/Languages/MatLab/Q_24268148.html
, thanks yuk99 for the help), I developed a function to read a binary raw data file in Matlab.
Each data sample is stored in the file in 2 bytes, it ranges from 0 to 4095 (12 bits).
In the 2 bytes corresponding to a data sample, the upper 4 bits contain an annotation information, and the 12 other bits contain the data sample.
My code works fine for files with small size, but I need to read a file with a size of about 500 Mb, and following error occurs:
??? Error using ==> fread
Out of memory. Type HELP MEMORY for your options.
Could someone help me optimize my code to avoid this error?
% Read all 2 bytes samples in 16 bits integers and retransform values in binary
% Close file
% Create an array containing the 12 bits of data