我有 100 个 .dat 文件,如左侧窗格中的文件,我需要导入不带标题的文件,然后对行进行排序。
ANSWER 手动执行,逐个文件:
data=sortrows(data,2); #sort all columns of data via the 2nd col
fid=fopen('pole_2_TurbI_chamber_05_RSM.xy');
[x ~] = textscan (fid, '%f %f', 'HeaderLines', 4); # reads file correctly
fclose(fid);
v(:,1)=cell2mat(x(:,1)); # convert from cell to array
v(:,2)=cell2mat(x(:,2));
v=sortrows(v,2); # sort rows according to column 2
% fig
plot(v(:,1),-v(:,2),'ro');
如何将其扩展到我目录中的所有文件?也许给每个导入的变量文件名......如果可能的话。问候,