How to import data for files that have 11,12,13,21,22,23,31,32,33 sequence?
1 回表示 (過去 30 日間)
古いコメントを表示
Hi, I would like to import files from a directory. The files have the following sequence:
Data 11
Data 12
Data 13
Data 21
Data 22
Data 23
Data 31
Data 32
Data 33
I usually use the following general code for extracting a sequence of files:
numfiles = 3;
mydata = cell(1, numfiles);
for k = 1:numfiles;
myfilename = sprintf('Drift.out', k);
mydata{k} = importdata(myfilename);
end
Can anyone please advise me on how to modify it to suit the above files sequence?
Thank you very much. Regards, Ismail
0 件のコメント
採用された回答
KSSV
2017 年 11 月 11 日
files = dir('*.out') ; % get all files with extension out
N = length(files) ; % toal number of files
% loop for each file
for i = 1:N
filename = files(i).name ;
% do what you want
end
4 件のコメント
KSSV
2017 年 11 月 11 日
What ever the names may be......it will list all the files present in the folder with extension out.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Cell Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!