MATLAB: Substitute all the values in a matrix

3d plotschange of coordinatesmatrix

I have a matrix like the one shown below. It is a three coordinate system, and I would like to change the values 38,39 and 40 for the values 0,1,2. And after that represent the obtained matrix in a 3D plot.
38 38 0.09
39 38 0.19
40 38 0.12
38 39 0.05
39 39 0.09
40 39 0.34
38 40 0.45
39 40 0.11
40 40 0.23

Best Answer

In this case:
M(:,1:2) = M(:,1:2)-38;
scatter3(M(:,1),M(:,2),M(:,3),M(:,3)*1000,M(:,3),'filled')
HTH