text - Handling carriage return/line feed in MATLAB GUI user controls -


i have matlab program developing in order image processing stuff , need use user control matlab gui user interface created ad-hoc.

this user control list box , there insert text. problem not cannot put text there, can using call:

set(handles.mylistbox, 'string', 'mystringtoprint'); 

well problem call not let me insert many lines in list box overwrite previous one.

i wish find way let code insert new text in new line. should not difficult , simple pattern:

texttoprint = 'my text add' oldtext = get(handles.mylistbox, 'string') %holding previous text here set(handles.mylistbox, 'string', [oldtext '\n' texttoprint]) %setting (no line feed printed) set(handles.mylistbox, 'string', [oldtext char(10) texttoprint]) %setting (this fails too) 

well ok , not raise error but, \n not work. not have new line... need to!!!!

how should solve this? problem need print text in user control, not on matlab commandline (that simple doing sprintf()).

what do? thank you

for listbox, set string property cell

set(mylistboxhandle,'string',{'myfirstline';'mysecondline'}) 

if want add line, call

contents = get(mylistboxhandle,'string'); set(mylistboxhandle,[contents;{'another line'}]) 

for multiline text in guis otherwise, use char(10) instead of \n, i.e.

set(someuicontrolhandle,'string',sprintf('my first line%smy second line',char(10))) 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -