newmerce的个人博客分享 http://blog.sciencenet.cn/u/newmerce

博文

read matlab binary file example

已有 2803 次阅读 2012-10-25 22:06 |个人分类:matlab|系统分类:科研笔记| MATLAB, div, HIDDEN, file, example

% write binary features and targets
% usage:[Features, Targets, flags, nFeatures]= readbin('training_pca.bin',5);
function [Features, Targets, flags, nFeatures]= readbin(FileName, nDim)

fid = fopen(FileName, 'r');

%file flag
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++
收藏 IP: 222.212.84.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-6-18 23:58

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部