Cell 2 3d matrix

조회 수: 5 (최근 30일)
Michal
Michal 2013년 12월 13일
댓글: Michal 2013년 12월 13일
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?

채택된 답변

Jos (10584)
Jos (10584) 2013년 12월 13일
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
Michal
Michal 2013년 12월 13일
Thank You;)

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Simon
Simon 2013년 12월 13일
If C is your cell, try
cat(3, C{:})
  댓글 수: 1
Michal
Michal 2013년 12월 13일
Thank You:)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by