Re: [問題] 用迴圈自動讀檔已回收

看板MATLAB作者 (KHAKI)時間16年前 (2009/08/05 13:07), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
我用的是mapping的方法 ================================================ database_map= cell(檔案總數,1); % Map file direc = '檔案路徑'; a = dir(direc); counter = 0; for i=1:length(a) if length(a(i).name)<3 continue; end if ~strcmp(a(i).name(end-2:end), '副檔名') continue; end counter = counter+1; database_map{counter,1} = a(i).name; if counter==檔案總數 break; end end ============================================== 然後就可以快樂的使用這些檔名了 PATH= '檔案路徑'; FILE= database_map{Count,1}; 不過你的檔名是有規律的 可能不用這麼麻煩XD -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.165.93.72 ※ 編輯: freedom76912 來自: 118.165.93.72 (08/05 13:16)
文章代碼(AID): #1AUHEavu (MATLAB)
文章代碼(AID): #1AUHEavu (MATLAB)