フィルターのクリア

How to merge two mat files

106 ビュー (過去 30 日間)
Piotr Lazuk
Piotr Lazuk 2016 年 7 月 6 日
コメント済み: Tholkappian R 2022 年 7 月 7 日
Hi! I have a problem with merging two .mat files into one. My mat files have 89 columns and about 70k verses. The thing is I need one big .mat file. Can anyone help me with this one?

回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2016 年 7 月 6 日
編集済み: Azzi Abdelmalek 2016 年 7 月 6 日
A mat file doesn't contain columns but variables. If you mean your two mat files contains a variable 'd' for example, that is nx89, then you need to load your two variables from your two mat files
a1=load('file1.mat')
f1=fieldnames(a1)
a2=load('file2.mat')
f2=fieldnames(a2);
v=[a1.(f1{1});a2.(f2{1})]
save new_file v
  3 件のコメント
Bajdar Nour
Bajdar Nour 2018 年 9 月 30 日
@ Azzi Abdelmalek, what it could be if each .mat file contains 50x19 feature elements?
Tholkappian R
Tholkappian R 2022 年 7 月 7 日
@Azzi Abdelmalek Thank you for posting your answer. Could please tell how to do it for multiple mat files, for example if i have more than 50 mat files , how to combine that into one mat file.Awaiting for your reply.

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

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT-Files についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by