フィルターのクリア

Loading multiple *mat files

3 ビュー (過去 30 日間)
Elizabeth Drybrugh
Elizabeth Drybrugh 2018 年 1 月 31 日
コメント済み: Stephen23 2018 年 1 月 31 日
all_data =[];
files = dir('*.mat');
for q = 1:lenght(files)
load(files(q).name);
all_data = [all_data D.F];
end
This is my code now but get an error load(files(q).name); saying error in read files... New to matlab so apologise in advance for silly mistakes.

採用された回答

Stephen23
Stephen23 2018 年 1 月 31 日
編集済み: Stephen23 2018 年 1 月 31 日
For a basic explanation see the MATLAB documentation:
If all of the .mat files contain the same variables then try something like this:
files = dir('*.mat');
out = load(files(1).name);
for k = 2:numel(files)
out(k) = load(files(k).name);
end
Your data is available in the non-scalar structure out, e.g.:
[out.F]
  1 件のコメント
Stephen23
Stephen23 2018 年 1 月 31 日
@Elizabeth Dryburgh: please show the complete error message. This means all of the red text.

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by