Scatter3 plot with patch properties

I have a logical N x N x N logical array isAct and I want a scatter plot of the 1's. The obvious choice is using find
[ii, jj, kk] = find(isAct);
and then
scatter3(ii,jj,kk)
However I want to apply some of the patch properties (lighting etc.).
[xx, yy, zz] = meshgrid(1:N,1:N,1:N);
value = 0.5;
hpiso = patch(isosurface(xx,yy,zz,double(isAct),value));
isonormals(xx,yy,zz,double(isAct),hpiso)
view(3)
I would expect this to work for value = 1, but it shows nothing (so I misunderstood something). For other values it works, but the objects it plots are not the 1's (they do not coincide with the result of scatter3).
Where am I wrong?

Answers (1)

That form of find() does not return x y z coordinates. That form of find returns row and column coordinates and value at the location. You should be using something like
pos = find(isAct);
[ii, jj, kk] = ind2sub(size(isAct),pos);
scatter3(ii,jj,kk)

Asked:

on 28 Jul 2016

Answered:

on 29 Jul 2016

Community Treasure Hunt

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

Start Hunting!