フィルターのクリア

adding letters to string

3 ビュー (過去 30 日間)
Max
Max 2015 年 11 月 8 日
回答済み: per isakson 2015 年 11 月 8 日
Say I start of with an empty string x=''
And I input something random say 'd' I would like x='d' then If I input a second thing say 'e' I would like x to then display x='de' and so on
Thanks
  1 件のコメント
per isakson
per isakson 2015 年 11 月 8 日
Input how?

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

回答 (2 件)

Walter Roberson
Walter Roberson 2015 年 11 月 8 日
x = 'd'
x(end+1) = 'e'

per isakson
per isakson 2015 年 11 月 8 日
Assuming "input" means that a user inputs letters interactively
str = '';
buf = {''};
while not( isempty( buf ) )
str = cat( 2, str, buf{1} );
buf = inputdlg( 'input one letter: ' );
end
str
and quit the loop with the [Cancel] button

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by