Hello Mat

 找回密码
 立即注册
查看: 1702|回复: 0

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

[复制链接]

1294

主题

1520

帖子

110

金钱

管理员

Rank: 9Rank: 9Rank: 9

积分
22633
发表于 2022-4-5 15:39:58 | 显示全部楼层 |阅读模式
  1. clc,clear, close all
  2. warning off
  3. FilePath='./';
  4. fileList = dir(FilePath);
  5. savePath='./';

  6. fid=fopen( [savePath, 'fileListName.txt'],'wt');   % 打开文件
  7. for i=1:length(fileList)
  8.     if strcmp(fileList(i).name,'.')==1||strcmp(fileList(i).name,'..')==1
  9.         continue;
  10.     else
  11.         fileList(i).name;

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

  14.     end
  15. end

  16. fclose(fid); %关闭文件
复制代码


算法QQ  3283892722
群智能算法链接http://halcom.cn/forum.php?mod=forumdisplay&fid=73
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Python|Opencv|MATLAB|Halcom.cn ( 蜀ICP备16027072号 )

GMT+8, 2024-4-23 20:31 , Processed in 0.218666 second(s), 21 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表