Hej, I have a cell [1x25] of [256x256 int16] I would like to convert cell into a 3d matrix [256x256x25] (create a stack) but if i using cell2mat I obtain a [256x6400] matrix. Could anyone halp me?

 Respuesta aceptada

Jos (10584)
Jos (10584) el 13 de Dic. de 2013

0 votos

Use CAT and comma-separated list expansion:
sz = [2 3] ; % arbitray size
C = {rand(sz), ones(sz), zeros(sz)} % example of your cell data (all elements the same size!)
M = cat(3,C{:}) % concatenate in the 3rd dimension

Más respuestas (1)

Simon
Simon el 13 de Dic. de 2013

0 votos

If C is your cell, try
cat(3, C{:})

Categorías

Más información sobre Matrices and Arrays en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 13 de Dic. de 2013

Comentada:

el 13 de Dic. de 2013

Community Treasure Hunt

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

Start Hunting!

Translated by