Delete part of the third dimension for arrays that store in the cell

1 visualización (últimos 30 días)
Hello all,
If I had just one 3d array I know I can use:
new = 3darray(:,:,2:end)
In order to delete the first number of the third dimension.
But as I have a lot of arrays that stored in the cell, I don't know how to do it automatically. Here what I tried so far:
for i= 1:numel(tmax) %if tmax is my cell that 3d arrays stored in it
b = tmax(i,1);
b = b(:,:,2:end);
end
But it doesn't work correctly and result me b = 1x1x0 cell
I'm sorry but as my data (even when I tried to cut just part of it) are too large to attach I just insert a picture here:
Thank you all

Respuesta aceptada

Sindar
Sindar el 24 de Mzo. de 2020
Editada: Sindar el 24 de Mzo. de 2020
to access the data in cells (rather than the cells themselves) and to store data in a new cell array, use {}
for i= 1:numel(tmax)
% iterates through every cell of tmax, regardless of dimensions
temp = tmax{i};
b{i} = temp(:,:,2:end);
end
% shapes b (originally 1D) to match tmax
b = reshape(b,size(tmax));

Más respuestas (0)

Categorías

Más información sobre Cell Arrays en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by