MATLAB: Extract some columns from a matrix

MATLABmatrix

Suppose I have a matrix A and suppose I want to create a new matrix from 1st, 3rd, and 4th column of A. Is there any compact way to do this?

Best Answer

B = A(:,[1 3 4])