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

1 vue (au cours des 30 derniers jours)
Alexandre
Alexandre le 8 Mar 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.

Réponse acceptée

Carlos
Carlos le 8 Mar 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
  1 commentaire
Alexandre
Alexandre le 8 Mar 2013
Thanks a lot, this is what I was expecting for!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by