Firstly, I know what it is and why it happens. I just want to know how to overcome the problem.
My code is as followed:
b=zeros(3,3,3); %returns an n-by-n matrix of zeros.
a=[0 1 1; 1 0 1; 1 1 0]; [r, c]=size(a); for i = 1:r b(a(i,c-2),a(i,c-1),a(i,c)) = 1; end [m, n, o]=size(b); figure (1) [x,y,z] = meshgrid(1:m,1:n,1:o); scatter3(x(:),y(:),z(:),90,b(:),'filled')
Best Answer