필터 지우기
필터 지우기

How to append multiple .mat files that have the same variable names in them?

조회 수: 4 (최근 30일)
Alex
Alex 2015년 6월 23일
답변: Titus Edelhofer 2015년 6월 23일
I run my scripts which produce hundreds or thousands of .mat files. Each of this file contains two variables: resultsU and resultsT. I want to append the files but not overwrite the variables. Is this possible without having to manually modify each .mat?

답변 (1개)

Titus Edelhofer
Titus Edelhofer 2015년 6월 23일
Hi Alex,
yes, that's possible.
  • Use dir to read all the files
  • Use the functional form of load, i.e.
data = load(filename(i).name);
  • concatenate the data
resultsUJoin = [resultsU; data.resultsU];
Titus

카테고리

Help CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by