MATLAB: Hello everyone, help for consolidation of numbers

double

Hello everyone,
I would like your help in the following :
How can i convert A = [1,2,3,4,5,6……n] to B = [123,456,……n],…….. ???
thanks in advance..!!

Best Answer

One convoluted way of doing this would be to convert to strings and back.
for i = 1:length(A)/3
B(i) = str2num([num2str(A(3*i-2)),num2str(A(3*i-1)),num2str(A(3*i))]);
end