matlab批量读取同一目录下的txt文件

万万没想到这么一个简单问题花费几天时间才搞定,严重怀疑自己的学习能力了。废话少说,我是读取目录:‘E:\轨迹\gesture dataset\自己数据集\data\总’   下的文件。直接来代码:


namelist  = dir('E:\轨迹\gesture dataset\自己数据集\data\总\*.txt');

% 读取后namelist 的格式为
% name -- filename
% date -- modification date
% bytes -- number of bytes allocated to the file
% isdir -- 1 if name is a directory and 0 if not


l = length(namelist);

 for i=1:l
        file_name{i}=namelist(i).name;
        x= load(file_name{i});
 end

这里得到的x为最后的txt文档内容,至于分别加载到不同的矩阵,正在研究中。。

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值