matlab read 读相片,想用matlab编一个读取实验数据的程序,用textread。

实验采集了一大堆数据,现在要对数据进行处理。

文件名是不规律的。

我的想法是,先把这个文件夹内的所有文件名读取进matlab。

然后设置一个循环,按照次序把文件名的每一个值赋值给textread。

想法比较简单,但是一直不成功啊。textread这个命令不太会用。

现在贴上程序,希望大神答疑解惑。

clc;

clear all;

close all;

%% --get filename--

filepath='C:\Users\Jie\Desktop\Recent Files';

file=dir(filepath);%data file location

filename0={file.name};%read the file name of the data file

filename=filename0(3:end);%remove the first and second useless filename‘.’and‘..’

[m,n]=size(filename);

filesize=n;%read the total file number

%% --readdata from file--

cd(filepath)

for i=1:n

a1=textread(filename(i));

end

数据运行完是这样:

未定义与 'cell' 类型的输入参数相对应的函数 'exist'。

出错 textread>noargname (line 190)

arg = f(arg);

出错 textread (line 157)

if (noargname(@exist,varargin{1}) ~= 2 ||

noargname(@exist,fullfile(cd,varargin{1})) ~= 2) ...

出错 readdata (line 16)

a1=textread(filename(i));

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值