Combine String matrix by each element

1 回表示 (過去 30 日間)
Dahai
Dahai 2013 年 11 月 25 日
コメント済み: Andreas Goser 2013 年 11 月 26 日
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 件)

Andreas Goser
Andreas Goser 2013 年 11 月 25 日

Walter Roberson
Walter Roberson 2013 年 11 月 26 日
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 ;-)

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeNumeric Types についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by