[MATLAB GUI] How can I add a string to the last line in multiline EditText?
1 回表示 (過去 30 日間)
古いコメントを表示
- Hi all,
- I often use this way to add a string to the last line in multiline editText:
- Example: The before editText: (handles.txtLine)
- "line 1
- line 2
- line 3"
- and i want to add string "line 4" to it. So i do:
- msg = get(handles.txtLine,'string');
- msg_i = sprintf('
4 件のコメント
Sara
2014 年 4 月 24 日
Do you get any particular error in doing it your way? Can you post the exact code you are using?
回答 (2 件)
per isakson
2014 年 4 月 24 日
編集済み: per isakson
2014 年 4 月 24 日
To me it isn't clear what your problem is. Anyhow there is no alternative to
set( h, 'String', string_values )
...
string_values = get( h, 'String' );
% add new line to string_value and
set( h, 'String', string_values )
However, I find it more convenient to use a cell array of strings for string_values. Doc says: For multiple line editable text [...] line breaks occur [...] each cell of a cell array of strings
0 件のコメント
Luong Son
2014 年 4 月 24 日
編集済み: Luong Son
2014 年 4 月 24 日
1 件のコメント
per isakson
2014 年 4 月 26 日
I stepped through your code but gave up. Obviously the string, "Send: OK", is not handled as you (and I) expect by guidata and handles.Mes.
First step might be to rename
pushbutton1_Callback
to something that includes the string
Receive
参考
カテゴリ
Help Center および File Exchange で String Parsing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!