Add additional name into a matrix

1 回表示 (過去 30 日間)
Yixuan Zhang
Yixuan Zhang 2019 年 9 月 15 日
回答済み: Rajanya 2025 年 3 月 20 日
I have a matrix X1x5, this matrix X is like [abc01,bcd12,cde03,def41,efg25]. Now I want to add (aaa34) after (efg25), what I can do? I really tried x = [:,aaa34]; but it showing an error.

回答 (1 件)

Rajanya
Rajanya 2025 年 3 月 20 日
Hi,
If 'X' is a string array, you can just concatenate the new string to 'X' like (refer here):
X = ["abc01", "bcd12", "cde03", "def41", "efg25"];
X = [ X, "aaa34" ]
X = 1x6 string array
"abc01" "bcd12" "cde03" "def41" "efg25" "aaa34"
Thanks.

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by