Halcom 发表于 2022-4-5 15:39:58

获取当前文件夹下全部文件名称

clc,clear, close all
warning off
FilePath='./';
fileList = dir(FilePath);
savePath='./';

fid=fopen( ,'wt');   % 打开文件
for i=1:length(fileList)
    if strcmp(fileList(i).name,'.')==1||strcmp(fileList(i).name,'..')==1
      continue;
    else
      fileList(i).name;

      fprintf(fid, fileList(i).name);% 输入数据
      fprintf(fid,'\n');

    end
end

fclose(fid); %关闭文件

页: [1]
查看完整版本: 获取当前文件夹下全部文件名称