Filter löschen
Filter löschen

Combine String matrix by each element

1 Ansicht (letzte 30 Tage)
Dahai
Dahai am 25 Nov. 2013
Kommentiert: Andreas Goser am 26 Nov. 2013
Hi, I want to combine 2 string matrix. e.g. A=['AA','BB';'CC','DD']; B=['E','F';'G','H']
How can I merge them into 1 matrix, like C=['AAE','BBF';'CCG','DDH']?
Thank you!

Antworten (2)

Andreas Goser
Andreas Goser am 25 Nov. 2013

Walter Roberson
Walter Roberson am 26 Nov. 2013
C = strcat(A, B)
This is a bit more general than Andreas solution, in that his solution requires that you be using char arrays, whereas strcat will also work will cell arrays of strings.
  1 Kommentar
Andreas Goser
Andreas Goser am 26 Nov. 2013
You are right. I must confess, sometimes I provide the coolest solution (smallest number of lines of characters ;-)

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Numeric Types finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by