引用問這個問題後:Matlab錯誤:???電池內容物從非單元陣列對象
how I can read the following files using the for loop: (can the loop ignore the characters in filenames?)
abc-1.TXT cde-2.TXT ser-3.TXT
wsz-4.TXT aqz-5.TXT iop-6.TXT
...(In fact, I have 500 files)
What do I have to add at the beginning of this loop ??
for i = 1:1:500
nom_fichier = strcat(['MyFile.......' num2str(i) '.TXT']);
我嘗試以下溶液:
Names = dir('MyFile\*.TXT');
for i = 1:500
fn = ['MyFile',filesep,Names{i},'-',num2str(i),'.TXT'];
data = load(fn);
.....
運行程序後,我得到以下錯誤:
??? Cell contents reference from a non-cell array object.
你能幫我解決這個問題嗎? 我的目標是閱讀500個文件的內容。
你是否必須根據某些特定的文件名模式來閱讀它們?或者讀取目錄中的所有文件就足夠了? – tzaman 2010-02-28 15:12:33
我想按照文件名中的數字順序讀取它們 – Matlab09 2010-02-28 17:48:22