Problem with combining .mat files

조회 수: 1 (최근 30일)
adele alias
adele alias 2019년 6월 20일
댓글: Adam Danz 2019년 6월 21일
Hi, I want to combine two .mat files that have the same matrice variables. The problem is when I combine them they are combined horizontally and I wish for them to be combined vertically.
Ex :
A (file1)=`
(222
111
333)
A(file2)=
(111
222
333)
Combined =
(222 111
111 222
333 333)
  댓글 수: 3
adele alias
adele alias 2019년 6월 21일
datacell1 = load('file1.mat');
datacell2 = load('file2.mat');
combined2.uu = [datacell1.uu, datacell2.uu];
combined2.vv = [datacell1.vv, datacell2.vv];
combined2.x1 = [datacell1.x1, datacell2.x1];
combined2.y1 = [datacell1.y1, datacell2.y1];
save('Combinedfile.mat', '-struct', 'combined2')
It combines the matrices horizontally and not vertically like I wish it would.
Adam Danz
Adam Danz 2019년 6월 21일
To concatenate vertically,
datacell1 = load('file1.mat');
datacell2 = load('file2.mat');
combined2.uu = [datacell1.uu; datacell2.uu];
combined2.vv = [datacell1.vv; datacell2.v
% ^ semicolon

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

답변 (1개)

Himanshu Tripathi
Himanshu Tripathi 2019년 6월 21일
  댓글 수: 1
adele alias
adele alias 2019년 6월 21일
Thankyou ! I used the function vertcat and it worked.

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

카테고리

Help CenterFile Exchange에서 Big Data Processing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by