MATLAB: Deleting a row or column of a matrix

matrix

I have a Matrix but I only need the first 20 columns of the matrix. I was wondering if there was a way to delete the rest of the matrix instead of having to create a new matrix all together. If it's not possible is there a better way of doing this compare to
for j=1:20
for k=1:20
u(j,k)=y(j,k)
end
end
Thanks in advance!

Best Answer

Or y(21:end,21:end)=[]
Related Question