我在一個名爲3410001ne => 3809962sw的文件夾中有大約1500個圖像。我需要將這些文件中的大約470個用Matlab代碼進行處理。下面是部分代碼之前,我對循環列出文件夾中的所有文件:子集文件夾內容Matlab
workingdir = 'Z:\project\code\';
datadir = 'Z:\project\input\area1\';
outputdir = 'Z:\project\output\area1\';
cd(workingdir) %points matlab to directory containing code
files = dir(fullfile(datadir, '*.tif'))
fileIndex = find(~[files.isdir]);
for i = 1:length(fileIndex)
fileName = files(fileIndex(i)).name;
文件還附上序方向(例如3410001ne,3410001nw),然而,並不是所有的方向與各關聯根。如何將文件夾內容分組爲包含1500個文件中的470個,範圍從3609902sw => 3610032sw?有沒有一個命令可以將Matlab指向文件夾中的一系列文件,而不是整個文件夾?提前致謝。
具體而言,如何準確地命名這些文件?據我所知,中間只有3610032-3609902 = 130個文件,所以你如何提出470? – Amro