Cell 2 3d matrix

3 Ansichten (letzte 30 Tage)
Michal
Michal am 13 Dez. 2013
Kommentiert: Michal am 13 Dez. 2013
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?

Akzeptierte Antwort

Jos (10584)
Jos (10584) am 13 Dez. 2013
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
  1 Kommentar
Michal
Michal am 13 Dez. 2013
Thank You;)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Simon
Simon am 13 Dez. 2013
If C is your cell, try
cat(3, C{:})
  1 Kommentar
Michal
Michal am 13 Dez. 2013
Thank You:)

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Cell Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by