MATLAB: Array: concatenate two columns of integers to one colum

array column element-wise concatenation

(Matlab novice)
I thought this would be so easy…
I have a 2-d array of integers and I want to combine two columns like this:
… 123 456 …
… 123 456 …
etc…
I want:
… 123456 …
… 123456 …
etc…
as single numbers (that is, I want (123 * 1000) + (456)
The number of rows will be variable from one run to the next.
Any help would be appreciated.

Best Answer

a = randi([1 100],[5 4]) % a 5x4 integer matrix
b = cellfun(@num2str,{a(:,2:3)},'UniformOutput',false)
c = cellfun(@(x) strrep(x,' ',''), cellstr(b{1}),'UniformOutput',false)
a(:,2) = str2double(c)
a(:,3) = []