Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将工作空间变量保存在多个excel文件中_Excel_Matlab - Fatal编程技术网

将工作空间变量保存在多个excel文件中

将工作空间变量保存在多个excel文件中,excel,matlab,Excel,Matlab,我有很多文本文件。每个文件中的数据格式为'511E7D7C:13,IIMWV,023,R,18.5,M,A*1D~05'; 我要第三和第五栏。为此,我使用textscan并将数据保存在单独的变量中。由于目录中有多个文件,所以我运行了for循环,并希望将这些变量保存在循环中的excel文件中。我正在使用eval和xlswrite,但它不起作用。如果有人知道正确答案,请指导我。 代码如下: enter code here files = dir('*.txt'); for i = 1:num

我有很多文本文件。每个文件中的数据格式为'511E7D7C:13,IIMWV,023,R,18.5,M,A*1D~05'; 我要第三和第五栏。为此,我使用textscan并将数据保存在单独的变量中。由于目录中有多个文件,所以我运行了for循环,并希望将这些变量保存在循环中的excel文件中。我正在使用eval和xlswrite,但它不起作用。如果有人知道正确答案,请指导我。 代码如下:

enter code here
files = dir('*.txt');    
for i = 1:numel(files);    
filename = files(i).name;    
fid = fopen(filename);
C = textscan(fid, '%s %s %s %s %s %s %s %s','delimiter',',');
variable1 = C{1,3};
eval9['xlswrite vdr' num2str(i) ' variable1']);
end

为什么它不起作用?它会静静地死去吗?你收到错误信息了吗?如果是,请发布。保存的不是变量中的数据,而是变量“var1”的名称。