Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: add new string to listbox
Replies: 2   Last Post: Nov 17, 2011 4:20 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Walter Roberson

Posts: 7,673
Registered: 1/20/06
Re: add new string to listbox
Posted: Mar 25, 2011 11:58 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 25/03/11 8:21 PM, zheng chew wrote:

> How can I add new strings into a listbox?
> By using \n doesn't seem to do the job.
> I tried:
>
> initial_name=get(handles.listbox,'String')
> new_name = sprintf('%s\n%s',initial_name,new_line) % assume there is a
> string store in variable new_line
> set(handles.listbox,'String',new_name) gives the new_line and
> initial_line on the same line.


initial_name=cellstr(get(handles.listbox,'String'));
new_name = [initial_name;{new_line}];
set(handles.listbox,'String',new_name)



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.