How can I convert matrix in cell array to same size cell array within the original array without for loop?

조회 수: 14 (최근 30일)
Hello,
Im struggling with following example:
I have a cell array 4x1, each cell containing 1x11 matrix. (say numbers 1 to 11)
How can I from this achieve a cell array, which is still 4x1 cell array, but each cell contains a 1x11 cells? (each number in original matrix converted into it's own cell)
I've done it with for loop, but I need to do so with more 'professional' move. I've read all the num2cell, mat2cell etc. tutorials, but still can't get it working.
Thank you for possible answers.
Tom

채택된 답변

Stephen23
Stephen23 2019년 1월 16일
편집: Stephen23 2019년 1월 16일
Where C is your 4x1 cell array:
D = cellfun(@num2cell,C,'uni',0)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

제품


릴리스

R2014b

Community Treasure Hunt

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

Start Hunting!

Translated by