How to convert a 4D double matrix into a cell array

16 次查看(过去 30 天)
Hi fellows;
I am having a 4D matrix, X (376 * 30 * 20 *44).
i want to convert the X matrix into the a cell array of (1*44), where every row in the output will be (376 * 30 * 20).
I have tried the following code, but does not work.
Anything will be appreciated .
A= num2cell (X, 376, 30, 20,[]);

采纳的回答

Stephen23
Stephen23 2022-2-17
A = rand(376,30,20,44);
C = num2cell(A,1:3);
C = reshape(C,1,[])
C = 1×44 cell array
{376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double} {376×30×20 double}

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Type Conversion 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by