MATLAB: How to combine two matrices of same size such that corresponding columns are concatenated as strings

combineMATLAB and Simulink Student Suitenumeric matrix

I am looking for ways to combine two numeric matrices of same size e.g x = [1 2;3 4], y = [4 5;6 7]
The result i am looking for is concatenation of corresponding columns similar to string concatenation: [14 25;36 47]

Best Answer

Wouldn't
10*x + y
be sufficient in your example?
Otherwise for a completely generic solution, since you want string concatenation, you need to convert to strings:
num2strcell = @(m) arrayfun(@num2str, m, 'UniformOutput', false); %function to convert matrix to cell array of strings
x = [10 2;3 4];
y = [4 5;6 700];
str2double(strcat(num2strcell(x), num2strcell(y)))