MATLAB Answers

0

Transferring cell array elements into a matrix

Asked by Stewart Tan on 13 Aug 2019
Latest activity Commented on by madhan ravi
on 13 Aug 2019
I have a cell array:
test_ca = {[1 2 3],[4 5 6];[7 8 9],[10 11 12]}
and i want to transfer these matrices in the cell array into a matrix where i would get:
new_mat = 1 2 3
4 5 6
7 8 9
10 11 12
however, i tried using cell2mat(test_ca) but ended up getting
new_mat = 1 2 3 4 5 6
7 8 9 10 11 12

  0 Comments

Sign in to comment.

1 Answer

Answer by madhan ravi
on 13 Aug 2019
 Accepted Answer

test_ca = {[1 2 3],[4 5 6];[7 8 9],[10 11 12]} .';
new_mat = cat(1,test_ca{:})

  2 Comments

@madhan ravi what is the ".' " operator called?

Sign in to comment.