MATLAB: How to Add two strings

additionarrayMATLABstring

Hi, I am trying to add two strings:
A = 'a b c d e'
B = '1 2 3 4 5'
if I want to return a value 'a1b2c3d4e5', how should I set this up?

Best Answer

For a char array of the same length, you can do as follows.
A = 'abcde';
B = '12345';
C = reshape([A;B],1,[]);