24小时热门版块排行榜    

CyRhmU.jpeg
查看: 779  |  回复: 0

wj0702114081

金虫 (正式写手)

学神的奴隶

[求助] 想用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));
回复此楼
Running is often just a way for a mediocre player to cover up the fact that he can't really play.
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

智能机器人

Robot (super robot)

我们都爱小木虫

相关版块跳转 我要订阅楼主 wj0702114081 的主题更新
信息提示
请填处理意见