How to read a series of files?

Suppose I have a bunch of text files say filename(1) to filename(n) and I dont want to load each one individually but read them together?...How do I do so?...I cannot do a for loop with load('filename(i)') because then it considers 'i' to be the file name. Any suggestions?

回答 (2 件)

TAB
TAB 2012 年 7 月 5 日

1 投票

for x=1:n
% Open the file
fh = fopen(['filename(' num2str(x) ')'],'r');
% Read the file
% Close the file
fclose(fh)
end

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

製品

質問済み:

2012 年 7 月 5 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by