I am a new user of Matlab; I am facing this problem that whenever I write into an edit box using 'set' command, result of last 'set' command is only displayed in the edit box. For example set(handles.edit1,'String','This is first statement'); set(handles.edit1,'String','This is second statement'); then only " This is second statement" string displayed in the edit box; where as I want both in the edit box. Please Guide me in this regard

 採用された回答

SRI
SRI 2014 年 6 月 13 日

0 投票

Hi Khurram, Please try this code which will help you in resulting both the statement in edit tool.
A = 'This is the first Set';
B = 'This is the second Set';
set(handles.edit1,'string',[A, B])

2 件のコメント

Khurram
Khurram 2014 年 6 月 17 日
Thank u dear, with yr suggestion my problem has solved. I used this command
set(handles.edit1,'string',{A, B})
Thank you All
abdulghani aldhaibani
abdulghani aldhaibani 2018 年 4 月 19 日
Thank you

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

その他の回答 (1 件)

Dishant Arora
Dishant Arora 2014 年 6 月 13 日

1 投票

String = {'This is first statement'};
set(handles.edit1 , 'String' , String);
String = {String{:},'This is the 2nd statement'};
set(handles.edit , 'Max' , 2) % To accomodate multi line text
set(handles.edit1 , 'String' , String);

1 件のコメント

Shri.s
Shri.s 2023 年 3 月 30 日
But this shows vertically in edit box ,i want to show horizantly in edit box ,is there any solution please.

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

カテゴリ

ヘルプ センター および File Exchange で Characters and Strings についてさらに検索

タグ

質問済み:

2014 年 6 月 13 日

コメント済み:

2023 年 3 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by