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 Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by