%% write data in bin format
fid=fopen('testbin.bin','wb');
data=rand(1,1000)>0.5;
if(fid>0)
count=fwrite(fid,data,'int8');
if(count==size(data,1)*size(data,2))
state=1;
else
state=-1;
end
end
fclose(fid);
%% read data in bin format
fid2=fopen('testbin.bin','rb');
M=1000;N=1;
if(fid2>0)
[data3,count]=fread(fid2,[M,N],'int8');
if(count==size(data3,1)*size(data3,2))
state=1;
else
state=-1;
end
end
fclose(fid2);
% 测试正常
加载中,请稍候......