How to merge two .mat files?

조회 수: 44 (최근 30일)
ANANTA BIJOY BHADRA
ANANTA BIJOY BHADRA 2022년 5월 23일
답변: MJFcoNaN 2022년 5월 24일
I have a data file where the number of rows=721800 and number of column=23. I have another .mat file with same number of rows and columns. Mergeing has to be in such a way that the 2nd m.mat file values starts from 721801. The cloumns will remain same. How can I merge them?
  댓글 수: 1
Triveni
Triveni 2022년 5월 23일
Load 1st .mat file. Then load 2nd .mat file. Assign 2nd .mat variable with different Name. And then combine.
Ex:
A1= [1 2 3]; A2= [ 4 5 6 ]
A = [ A1 , A2];
Or A= [A1; A2]

댓글을 달려면 로그인하십시오.

채택된 답변

MJFcoNaN
MJFcoNaN 2022년 5월 24일
If they share the same variable name (for example 'data'), you can load them into different structure and merge.
s1=load('file1.mat');
s2=load('file2.mat');
% vertical concatenate
data=[s1.data; s2.data];

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by