I have problem to change value matrix in specific “depth”
R = 6;
C = 12;
depth = 6
for j=1:depth;
result(:,:,j)=randint(R,C,[0 2])
for i=1:R,
A(i,:,j)=randperm(C);
end
end
this following code that i have used currently
but this code only still work from 1th depth. then, I wish that my code would be work from 3th depth (h=3:depth).
for h=3:depth;
idx = bitand(A(:,:,h)>= 1, A(:,:,h)<= 4);
result([false(size(idx,1),1) idx(:,1:end-1)]) = 3
result(idx)=1
end
anyone have suggestion to improve that code??
This question is quite vague. If all you want to know is how 3D indexing is working, you can
play around with the following code: