matlab 写txt文件


clear all;

clc;
scenes = dir(fullfile('D:/Resized'));

fid1=['name','.txt'];   %创建新的txt文件
c=fopen(fid1,'wt');   %打开txt文件
for i=3:size(scenes,1)
    str=['D:/Resized/' scenes(i,1).name];
    fprintf(c,'%s\n',str);        %按行写入txt文件,%s为数据形式,str为写入数据。。。
end
fclose(c);    %关闭txt文件

你可能感兴趣的:(matlab 写txt文件)