MATLAB: 4D scatterplot with one indicator value

4ddata explorationscatter3

Hello,
I have four vectors: s1, s2, s3 as parameter vectors and vector i with indicator values of 0 or 1.
I would like to plot all s1-s2-s3 parameter combinations with value i = 1 with one color and all other s1-s2-s3 parameter combinations with value i = 0 with another color.
Thank you.

Best Answer

pointsize = 8;
[s1g, s2g, s3g] = ndgrid(s1, s2, s3);
scatter3(s1g, s2g, s3g, pointsize, i);
colormap([1 0 0;0 1 0]);
However, before you do this, you will have to convert i from being a vector to being a matrix defined at each s1 x s2 x s3 possibility.