以下为matlab版本代码
M=dir('D:\matlab\*'); %读取文件路径
f=fopen('D:\matlab\text.txt','w+'); %输出文件路径
for n=1:length(M)
fprintf(f,'%s\r\n',M(n).name);
end
fclose(f);
注:python版本可参考小编上一篇文章链接如下:
https://blog.csdn.net/weixin_43876801/article/details/102896570
以下为matlab版本代码
M=dir('D:\matlab\*'); %读取文件路径
f=fopen('D:\matlab\text.txt','w+'); %输出文件路径
for n=1:length(M)
fprintf(f,'%s\r\n',M(n).name);
end
fclose(f);
注:python版本可参考小编上一篇文章链接如下:
https://blog.csdn.net/weixin_43876801/article/details/102896570