The simplest technique is to use inbuilt Matlab function 'randscr'.
Suppose you want to generate M by N matrix of W, X, Y, and Z with probabilities i,j,k, and l. Then use
out = randsrc(M,N,[W,X,Y,Z;i,j,k,l]);
In your case, as you want a single value to be generated, your M x N = 1 x 1 matrix; the values are 1 with 60% probability (i.e. 0.6) and 2 with 40% (i.e. 0.4) probability, therefore use this;
out = randsrc(1,1,[1,2;0.6,0.4]);
Note that the above is just an example. You can create any matrix size with any number of values. The sum of probabilities must be equal to 1.