, , :
:
data = double(rand(16,2^20) <= 0.00001); %
%
fid = fopen('data_double.dat','w'); %
fwrite(fid,size(data),'uint32'); %
fwrite(fid,data,'double'); %
fclose(fid); %
%
fid = fopen('data_uint8.dat','w'); %
fwrite(fid,size(data),'uint32'); %
fwrite(fid,data,'uint8'); %
fclose(fid); %
%
[rowIndex,columnIndex,values] = find(data); %
%
fid = fopen('data_sparse.dat','w'); %
fwrite(fid,numel(values),'uint32'); %
fwrite(fid,rowIndex,'uint32'); %
fwrite(fid,columnIndex,'uint32'); %
fwrite(fid,values,'uint8'); %
fclose(fid); %
, , . 'data_double.dat' 131 073 , 'data_uint8.dat' 16,385 , 'data_sparse.dat' 2 .
, \ , ( FREAD) . , 'double' 'uint8' FWRITE, MATLAB , 8 ( 0 1).