Filter löschen
Filter löschen

Problem with combining .mat files

1 Ansicht (letzte 30 Tage)
adele alias
adele alias am 20 Jun. 2019
Kommentiert: Adam Danz am 21 Jun. 2019
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 Kommentare
adele alias
adele alias am 21 Jun. 2019
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 am 21 Jun. 2019
To concatenate vertically,
datacell1 = load('file1.mat');
datacell2 = load('file2.mat');
combined2.uu = [datacell1.uu; datacell2.uu];
combined2.vv = [datacell1.vv; datacell2.v
% ^ semicolon

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Himanshu Tripathi
Himanshu Tripathi am 21 Jun. 2019
  1 Kommentar
adele alias
adele alias am 21 Jun. 2019
Thankyou ! I used the function vertcat and it worked.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by