How fill a part of 3D array with decreasing values?

1 visualización (últimos 30 días)
Alexandre
Alexandre el 8 de Mzo. de 2013
Dear all,
I have a 3D array and I just want to fill a buck of this array with decreasing values, with step i've chosen. The values would decrease only in one direction, and constant on the two others.
For instance i have this : >> N=10; >> X=zeros(N,N,N); >> X(:,:,1:10)=20:-2:2; ??? Assignment has fewer non-singleton rhs dimensions than non-singleton subscripts
Could somebody help me with the syntax please?
Thanks in advance.
Alexandre.

Respuesta aceptada

Carlos
Carlos el 8 de Mzo. de 2013
I think you are trying to do something like this
>> a=20:-2:2;
>> for i=1:10
for j=1:10
X(i,j,1:10)=a(1:10);
end
end

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing 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