MATLAB: How to remove the last column in the matrix

MATLABmatrix

Hello! There are matrices, I need to delete the last column, how would I do this?
A=[2 4 2 4 2 6 8];
[x,y]=size(A);
A(:, y) = [];
I try something like this, but I need to change the changed data to another array

Best Answer

>> A = [2,4,2,4,2,6,8]
A =
2 4 2 4 2 6 8
>> B = A(1:end-1)
B =
2 4 2 4 2 6