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

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Resizing 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