Transferring cell array elements into a matrix

1 vue (au cours des 30 derniers jours)
Stewart Tan
Stewart Tan le 13 Août 2019
Commenté : madhan ravi le 13 Août 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

Réponse acceptée

madhan ravi
madhan ravi le 13 Août 2019
test_ca = {[1 2 3],[4 5 6];[7 8 9],[10 11 12]} .';
new_mat = cat(1,test_ca{:})
  2 commentaires
Stewart Tan
Stewart Tan le 13 Août 2019
@madhan ravi what is the ".' " operator called?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Image Processing Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by