function value = bread( fid, bits, num );
%This function reads the encoded binary file from UNIX into Matlab. 

if( bits > 0 ), 
  if ( exist('num','var') )
    value = fread( fid, num, sprintf('bit%d', bits ));
  else
    value = fread( fid, sprintf('bit%d', bits ));
  end
end   

