MATLAB: In Matlab: How to create a 2d map from a 3 columns file

figureplot

Relatively new to Matlab, I've been tryin to create a 2d map from a 3 columns file (x coord, y coord, value of cell (x,y)) but not sure how to proceed.
For example:
1901 0 1
1901 -10 2
1901 -20 3
1902 0 -1
1902 -10 3.5
1902 -20 1.5
1903 0 5
1903 -10 -3
1903 -20 0
Thanks in advance for any help!

Best Answer

data = [1901 0 1
1901 -10 2
1901 -20 3
1902 0 -1
1902 -10 3.5
1902 -20 1.5
1903 0 5
1903 -10 -3
1903 -20 0 ] ;
x = data(:,1) ; y = data(:,2) ; z = data(:,3) ;
nx = length(unique(x)) ;
ny = length(unique(y)) ;
X = reshape(x,[ny,nx]) ;
Y = reshape(y,[ny,nx]) ;
Z = reshape(z,[ny,nx]) ;
pcolor(X,Y,Z)
shading interp
colorbar