# Accessing Cell Array elements

1 visualización (últimos 30 días)
Swarnava Pramanik el 15 de Mzo. de 2015
Comentada: Swarnava Pramanik el 15 de Mzo. de 2015
I have a cell array which consists of 10 cells. Each of the 10 cells has a matrix of size 250 by 2. I need to access the second column of each of the matrix of size 250 by 2. How can I access it . Please help. I'm using the following method :
where length(t) =250 and azi_all is the 1 by 10 cell
c = zeros(length(t),1);
for cc = 1 : 10
zenith{cc} = c;
end
for i = 1:10
zenith{i} = 90 - azi_all{1,i};
end
When I'm using the above code both the columns are being modified as per the (zenith{i} = 90 - azi_all{1,i};) equation whereas I need only the value of the second column to be changed. Please suggest some way.
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

### Respuesta aceptada

Andrew Newell el 15 de Mzo. de 2015
I'm not sure I understand all the details of what you are trying to do, but I can show you with an example how to modify the second column (in this case, setting all the values to zero):
C = {rand(10,2),rand(10,2)};
C{1}(:,2) = 0;
disp(C{1})
0.1622 0
0.7943 0
0.3112 0
0.5285 0
0.1656 0
0.6020 0
0.2630 0
0.6541 0
0.6892 0
0.7482 0
##### 1 comentarioMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos
Swarnava Pramanik el 15 de Mzo. de 2015
Thanks a lot Andrew. It really worked. Thanks again.

Iniciar sesión para comentar.

### Categorías

Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.

### Community Treasure Hunt

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

Start Hunting!

Translated by