Combining a number and a string array (both columns) into a single column string array.

3 ビュー (過去 30 日間)
Saeid
Saeid 2022 年 2 月 14 日
コメント済み: Saeid 2022 年 2 月 15 日
How can the number array:
NUMM=linspace(1,10,10)'
and the string array:
STRR=repmat('X='10,1)
be combined to give a string array?
["X=1"
"X=2"
...
"X=10"]

回答 (2 件)

Stephen23
Stephen23 2022 年 2 月 15 日
The simple MATLAB approach:
V = linspace(1,10,10);
S = "X=" + V(:)
S = 10×1 string array
"X=1" "X=2" "X=3" "X=4" "X=5" "X=6" "X=7" "X=8" "X=9" "X=10"

David Hill
David Hill 2022 年 2 月 14 日
s=string(strcat(STRR,num2str(NUMM)));

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by