How to import a lot of .blf data files?

7 ビュー (過去 30 日間)
Aymen Rejab
Aymen Rejab 2021 年 1 月 22 日
コメント済み: Chong Wang 2023 年 7 月 6 日
hello i want to import to matlab a lot of data files with one line to write on MatLab instead of that all line.
The files are .blf files:
2020_10_20__06_19_48.blf;
2020_10_20__06_09_92.blf;
2020_10_20__06_03_95.blf;
2020_10_20__06_82_08.blf;
2020_10_20__06_19_46.blf;
.
.
.
.
  4 件のコメント
Aymen Rejab
Aymen Rejab 2021 年 1 月 22 日
Hello,
Actually, I could read the files but one by one with the function blfread(...) but the problem is that I want to import hundreds of them at the same time
Mathieu NOE
Mathieu NOE 2021 年 1 月 22 日
so look at my suggestions - i'll be glad to further help you if you're still in trouble

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2021 年 1 月 22 日
dinfo = dir('2020*.blf');
filenames = {dinfo.name};
numfiles = length(filenames);
contents = cell(numfiles,1);
for K = 1 : numfiles
contents{K} = blfread(filenames{K});
end
You now have a cell array contents with one entry for each file matched by 2020*.blf .
This code does not assume that they are all the same size.
Depending on what has to be done with them, it would not be uncommon to use
M = cat(ndims(contents{1})+1, contents{:});
to create a single matrix M with all of the contents.
  3 件のコメント
Walter Roberson
Walter Roberson 2021 年 1 月 22 日
please post the code you are testing and the complete associated error message
Chong Wang
Chong Wang 2023 年 7 月 6 日
very brilliant solution.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDatabase Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by