Need help with extracting data from n-dimension cell matrix

조회 수: 1 (최근 30일)
christian
christian 2014년 3월 11일
댓글: christian 2014년 3월 12일
Hi, I have a 76x102x5 cell matrix. I would like to create a single array of data from each index for n-dimensions. For example,
for k = 1:5
array = cell{1,1,k};
end
output = [ 1 2 3 4 5 ];
so its only the numbers from the same index but in different dimensions.
  댓글 수: 4
Walter Roberson
Walter Roberson 2014년 3월 11일
What shape of data is stored in each element of the cell array? Is it certain to be consistent?
christian
christian 2014년 3월 12일
편집: christian 2014년 3월 12일
sorry, if its confusing. Ok let me try to rephrase the question. Lets say, for example, I have a 2x2x3 cell. The data stored in each element is a double, specifically a number between 0-1. I am calculating the correlation coefficient of different sections of an an image between multiple images. So i may have n = 3 pictures, meaning n = 3 dimensions in my cell array.
corrValue(:,:,1) = [1][1]
[1][1]
corrValue(:,:,2) = [0.989][0.999]
[1][0.899]
corrValue(:,:,3) = [0.899][.998]
[0.997][0.899]
I want to extract the data store in each element for the n - dimensions. So for my output. I want to get an array for the (1,1) index,
array = [1 0.989 0.899]; %(1,1) index
The reason being I want to generate a decorrelation curve for each section of the image; therefore, I need to plot the correlation coefficient with respect to the number of images i have taken.

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

채택된 답변

sd
sd 2014년 3월 12일
I don't fully understand what you are trying, but lets see if this helps you
% This is just to create cell array
ar=rand(2,2,3);
ca=mat2cell(ar,ones(1,2),ones(1,2),ones(1,3));
% Now from above cell array extract double array
da=cell2mat(ca(1,1,:));
da=da(:);
  댓글 수: 1
christian
christian 2014년 3월 12일
Perfect! This is exactly what I was trying to do. Thank you.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by