How to display Multiple Statements in a GUI Edit Box

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

 Respuesta aceptada

SRI
SRI el 13 de Jun. de 2014
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 comentarios

Khurram
Khurram el 17 de Jun. de 2014
Thank u dear, with yr suggestion my problem has solved. I used this command
set(handles.edit1,'string',{A, B})
Thank you All
Thank you

Iniciar sesión para comentar.

Más respuestas (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 comentario

Shri.s
Shri.s el 30 de Mzo. de 2023
But this shows vertically in edit box ,i want to show horizantly in edit box ,is there any solution please.

Iniciar sesión para comentar.

Categorías

Más información sobre Environment and Settings en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 13 de Jun. de 2014

Comentada:

el 30 de Mzo. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by