Adding String to end of an Matrix

I simply want to add a string to a matrix without combining them
for instance:
word = "";
wordlist = [];
for n = [1:3]
word = input("Word: ","s");
wordlist = [wordlist,word];
end
if the three inputs are "first", "second", "third", would make wordlist = 'firstsecondthird'.
How do I get worldlist to be ['first', 'second', 'third']?

 採用された回答

Ive J
Ive J 2023 年 11 月 30 日

0 投票

wordlist = strings(3, 1);
for n = 1:3
wordlist(n) = input("Word: ","s");
end

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGraph and Network Algorithms についてさらに検索

製品

リリース

R2023a

質問済み:

2023 年 11 月 30 日

回答済み:

2023 年 11 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by