Effacer les filtres
Effacer les filtres

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

16 vues (au cours des 30 derniers jours)
Abdulhakim Alezzi
Abdulhakim Alezzi le 17 Fév 2022
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,[]);

Réponse acceptée

Stephen23
Stephen23 le 17 Fév 2022
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}
  1 commentaire
Abdulhakim Alezzi
Abdulhakim Alezzi le 17 Fév 2022
Thank you so much Stephen, it is all right now.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Type Conversion dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by