How to attach multiple matrices to a single matrix?
Show older comments
There are A, B, C, and D matrices of 100x1 size.
I would like to combine this data into a matrix of 400x1 size.
However, the conditions must be followed by 5x1 of each matrix.
A = [1,2,3,4,5,6,7,8,9,10....]
B = [a,b,c,d,e,f,g,h,i,j...]
C = [11,22,33,44,55,66,77,88,99...]
D = [A,B,C,D,E,F,G,H,I,J...]
Assuming that it's like this,
F = [1,2,3,4,5,a,b,c,d,e,11,22,33,44,55,A,B,C,D,E,...]
I'm going to make these results.
The method I tried was:
Inside the for loop
Use the fseek function to add 'offset=0' first and then 'offset=5'.
I saved it using the spread function.
I got the result I wanted.
I'm wondering what else you can do.
Accepted Answer
More Answers (1)
A = [1,2,3,4,5,6,7,8,9,10];
B = {'a','b','c','d','e','f','g','h','i','j'};
C = [11,22,33,44,55,66,77,88,99,100];
D = {'A','B','C','D','E','F','G','H','I','J'};
idx=1:5;
out2=[A(idx) string(B(idx)) C(idx) string(D(idx))]
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!