Info
This question is closed. Reopen it to edit or answer.
want to make a number of row matrix from a single row matrix
    2 views (last 30 days)
  
       Show older comments
    
i have a file with
line1:[1 2 3 4 5 6 7 8 9]
line2:[10 11 12 13 14 15 16 17 18] now i want to make a 3d matrix by
split line1 as[1 2 3],[4 5 6],[7,8,9]
and line2 as[10 11 12],[13,14 15],[16 17 18].
then i want to make 3 new matrixes as
mat1 =
        [1  2  3;10 11 12]
mat2=
       [ 4  5  6;13 14 15]
and
       [7 8 9;16 17 18]
0 Comments
Answers (2)
  Andrei Bobrov
      
      
 on 25 Oct 2016
        
      Edited: Andrei Bobrov
      
      
 on 25 Oct 2016
  
      Let A - your matrix (2 x 9)
A = reshape(1:18,[],2)';
out = reshape(A,2,3,[]);
2 Comments
  Andrei Bobrov
      
      
 on 25 Oct 2016
				you said: "then i want to make 3 new matrixes as
mat1 = [1 2 3;10 11 12]
mat2 = [ 4 5 6;13 14 15]
and [7 8 9;16 17 18]"
  Thorsten
      
      
 on 25 Oct 2016
        Your description is somewhat unclear to me. Do you mean
cat(3, reshape(line1, [3 3])', reshape(line2, [3 3])')
0 Comments
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

