Need help with extracting data from n-dimension cell matrix

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 comentarios

Not clear for me
dpb
dpb el 11 de Mzo. de 2014
Me neither but wonder if wouldn't be simpler if OP used cell2mat then proceeded...
What shape of data is stored in each element of the cell array? Is it certain to be consistent?
christian
christian el 12 de Mzo. de 2014
Editada: christian el 12 de Mzo. de 2014
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.

Iniciar sesión para comentar.

 Respuesta aceptada

sd
sd el 12 de Mzo. de 2014
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 comentario

Perfect! This is exactly what I was trying to do. Thank you.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Preguntada:

el 11 de Mzo. de 2014

Comentada:

el 12 de Mzo. de 2014

Community Treasure Hunt

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

Start Hunting!

Translated by