read matlab binary file example
已有 2803 次阅读
2012-10-25 22:06
|个人分类:matlab|系统分类:科研笔记|
MATLAB, div, HIDDEN, file, example
% usage:[Features, Targets, flags, nFeatures]= readbin('training_pca.bin',5);
function [Features, Targets, flags, nFeatures]= readbin(FileName, nDim)
fid = fopen(FileName, 'r');
flags = fread(fid,1,'int');
%get features size
nFeatures =fread(fid,1,'int');
for i = 1: nDim
Targets(i)=fread(fid,1,'int');
Features(i,:)=fread(fid,nFeatures,'double');
end
fclose(fid);
https://wap.sciencenet.cn/blog-259088-626151.html
上一篇:
write matlab binary file example下一篇:
A template converting number type to string in C++