MATLAB: How to plot color indication on the points in 2D and 3D

r2012a color 2d 3d

I have a set of data looks like this
X Y Z Intensity
-10 -10 15 100
-10 -10 16 200
-9 -10 15 150
-9 -10 16 130
-8 -10 15 110
-8 -10 16 117
-10 -9 15 210
-10 -9 16 189
-9 -9 15 234
-9 -9 16 156
-8 -9 15 175
-8 -9 16 183
-10 -8 15 216
-10 -8 16 260
-9 -8 15 144
-9 -8 16 190
-8 -8 15 128
-8 -8 16 219
The actual data file is much bigger. In the X-Y plane, I was trying to plot the color indication with the given Intensity for a fixed point in Z.
And is it possible that i cant plot a 3D view with the color indications using the current fields of data that I've.
I had tried to looked up on colormap, surf functions, but I don't know how to use them correctly.
Thanks

Best Answer

pointsize = 20;
scatter3(x(:), y(:), z(:), pointsize, intensity(:));
You can take subsets of the data for particular z, if you want. For example
idx = z == 16; %watch out for floating point comparisons if the values are not integers!
scatter3(x(idx), y(idx), z(idx), pointsize, intensity(idx));