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,[]); Related SolutionsMATLAB: ADDING ZEROS to the front of array newA = [zeros(1, max(0, numel(B)-numel(A))), A] MATLAB: Combine 2 char vectors This will mix them as described in questionC = repmat(' ', 1, 2*numel(A))C(1:2:end) = A;C(2:2:end) = [repmat(B, 1, floor(numel(A)/numel(B))) B(1:rem(numel(A), numel(B)))];For example,A='IMDOINGATEST'B='ABCDE'will produceC = 'IAMBDCODIENAGBACTDEESATB'andA='IMDO'B='ABCDE'will mix to formC = 'IAMBDCOD' % no repetition of A Related QuestionHow to make vectors zero when adding two different size vectorsHow to add zeros to the end of an arrayModifying a stringBuilding the Matrix from the two matricesHow to vectorize the following code
Best Answer