MATLAB: Rearranging matrix from 5×6 to 5×5, removing remaining elements.

MATLABmatrixrearrangingremoveshift matrix elements

To whom it may concern,
I have a question regarding rearranging a matrix, e.g. let's say I have a 5×6 matrix and want to rearrange it to a 5×5, therby deleting the last four elements in the last row in the original matrix. How do I reach the following result?
original matrix:
%original matrix 5x6:
A = [ -0.003892574000000 -0.003322995000000 0.004232727000000 0.006965289000000 -0.002204901000000 -0.012782820000000
-0.020261750000000 0.021563530000000 -0.007849661000000 0.004581667000000 -0.010833600000000 -0.020849070000000
0.036836380000000 -0.030288890000000 0.013160800000000 -0.001190723000000 0.001117899000000 0.014237140000000
-0.011741560000000 0.011948250000000 0 0 0 0
0 0 0 0 0 0]
%desired matrix:
B = [ -0.003892574000000 -0.003322995000000 0.004232727000000 0.006965289000000 -0.002204901000000
-0.012782820000000 -0.020261750000000 0.021563530000000 -0.007849661000000 0.004581667000000
-0.010833600000000 -0.020849070000000 0.036836380000000 -0.030288890000000 0.013160800000000
-0.001190723000000 0.001117899000000 0.014237140000000 -0.011741560000000 0.011948250000000
0 0 0 0 0]
Help appriciated!

Best Answer

Using your matrix 'A' defined in the question, this solution horizontally shifts the data rightward moving to the next row after column 5. Then it gets rid of the final column to produce the 5x5 matrix 'B' defined in the question.
Atr = reshape(A',[5,6]);
B0 = Atr(:,1:end-1)'; %note the transpose
% Test that it matches desired output
isequal(B,B0)
%ans =
% logical
% 1