MATLAB: How to retrieve last 3 digits from each entry of a matrix of order 3 x 4

last 3 digitsmarix

Let A = [35679, 35678, 35677, 35676; 35675, 35674, 35673, 35672; 35671, 35670, 35669, 35668];
how can I extract last 3 digits from each entry of the matrix 'A' ?

Best Answer

solution:
A = [35679, 35678, 35677, 35676; 35675, 35674, 35673, 35672; 35671, 35670, 35669, 35668];
last3digits=A-round(A,-3);
last3digits(last3digits<0)=last3digits(last3digits<0)+1000;
disp(last3digits)