필터 지우기
필터 지우기

How to resize the element matrix inside a cell array?

조회 수: 3 (최근 30일)
DEEPAK PHCSFI17041149
DEEPAK PHCSFI17041149 2017년 12월 13일
댓글: DEEPAK PHCSFI17041149 2017년 12월 14일
I have a 1x8 cell array with elements composed of the following dimension.
10x13x2 double 10x13x2 double 10x13x2 double 10x13x2 double 10x13x2 double 10x13x2 double 10x13x2 double 10x13x2 double
in which the third dimension 2 represents the mean and variance values. in each cell, i have 130 values representing Mean(M) at (:,:,1) and another 130 values representing variance(V) at (:,:,2). now i want this 10x13x2 cells reshaped as,
260x1 260x1 260x1 260x1 260x1 260x1 260x1 260x1
That represents that the 130 values of mean and 130 values of variance should be combined in a way that it becomes,[M1 V1] [M2 V2]....[M130 V130] in each cell.
How can i do this?

채택된 답변

Andrei Bobrov
Andrei Bobrov 2017년 12월 13일
편집: Andrei Bobrov 2017년 12월 13일
Here Z - your cell array
z4 = cat(4,Z{:})
out = reshape(cat(4,Z{:}),[],size(z4,4));
or
out = reshape(permute(cat(4,Z{:}),[2,1,3,4]),[],size(z4,4));

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by