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

1 次查看(过去 30 天)
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.

采纳的回答

Carlos
Carlos 2013-3-8
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by