Combine String matrix by each element

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!

답변 (2개)

Walter Roberson
Walter Roberson 2013년 11월 26일

0 개 추천

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

Andreas Goser
Andreas Goser 2013년 11월 26일
You are right. I must confess, sometimes I provide the coolest solution (smallest number of lines of characters ;-)

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

질문:

2013년 11월 25일

댓글:

2013년 11월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by