Transferring cell array elements into a matrix

1 回表示 (過去 30 日間)
Stewart Tan
Stewart Tan 2019 年 8 月 13 日
コメント済み: madhan ravi 2019 年 8 月 13 日
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

採用された回答

madhan ravi
madhan ravi 2019 年 8 月 13 日
test_ca = {[1 2 3],[4 5 6];[7 8 9],[10 11 12]} .';
new_mat = cat(1,test_ca{:})
  2 件のコメント
Stewart Tan
Stewart Tan 2019 年 8 月 13 日
@madhan ravi what is the ".' " operator called?
madhan ravi
madhan ravi 2019 年 8 月 13 日

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by