Save matrices (present within a cell) into a single matrix

1 回表示 (過去 30 日間)
Alberto Acri
Alberto Acri 2023 年 1 月 5 日
コメント済み: Stephen23 2023 年 1 月 10 日
Hi. I would like to save matrices (present within a cell) into one single matrix. How can I do this?
Here is an example of a cell:
C = {rand(1225,3), rand(844,3), rand(1004,3), rand(252,3), rand(779,3)};
I would like to get the result below ("matrix") but without manually creating all the matrices (C1, C2, C3, C4, C5) present inside the cell.
C = {rand(1225,3), rand(844,3), rand(1004,3), rand(252,3), rand(779,3)};
C1 = C{1,1};
C2 = C{1,2};
C3 = C{1,3};
C4 = C{1,4};
C5 = C{1,5};
matrix = [C1; C2; C3; C4; C5];

採用された回答

Fangjun Jiang
Fangjun Jiang 2023 年 1 月 5 日
C={rand(2,3), rand(4,3),rand(5,3)};
D=cell2mat(C')
D = 11×3
0.7979 0.1673 0.1573 0.0727 0.8890 0.5308 0.9318 0.8525 0.1702 0.7646 0.5018 0.3824 0.1174 0.5170 0.2963 0.9404 0.4847 0.2988 0.9093 0.2932 0.2371 0.7827 0.5784 0.8486 0.0534 0.1470 0.1571 0.5680 0.5896 0.9516

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by