From: Jan Simon on
Dear Mike,

Frédéric wrote:
> Have you tried writing the text for the 'string' property in a cell array, where different cells mean different lines?

E.g.:
H = uicontrol('Style', 'listbox', ...
'Units', 'normalized', ...
'Position', [0, 0, 1, 1], ...
'String', {'First line'});
drawnow;
pause(1.0);

set(H, 'String', cat(1, get(H, 'String'), {'Second line'}));
drawnow;
pause(1.0);

set(H, 'String', cat(1, get(H, 'String'), {'Third line'}));
drawnow;
pause(1.0);

The DRAWNOW are important, if the PAUSE vanishes in a real program.
Of course you could collect the cell string anywhere else, e.g. as persistent variable, as UserData of the FIGURE, with SETAPPDATA. With the above method your program needs to remember only the handle of the listbox.

Nevertheless, I'd still prefer the standard command window.

Jan
From: Andy on
"Mike " <mikejcunningham(a)gmail.com> wrote in message <i02ksb$c6s$1(a)fred.mathworks.com>...
> Andy, I don't think the listbox will give me the format I want. But I will see what I can do with it.
>

I don't know what you mean by "format". Here's an example:


function mygui
f=figure('units','pixels','position',[30 100 500 300]);
l=uicontrol('parent',f,'style','list','units','pixels','position',[30 10 300 250],'String',{'Starting'});
pb=uicontrol('parent',f,'style','push','units','pixels','position',[30 270 80 20],'string','Run','callback',{@pb_call});


function pb_call(varargin)
cur_log = get(l,'String');
new_log = [cur_log ; {'Running ...'}];
set(l,'String',new_log);
pause(1);
new_log = [cur_log ; {'Running ... Done'}];
set(l,'String',new_log);
end

end
From: Yair Altman on
> Andy, I don't think the listbox will give me the format I want. But I will see what I can do with it.

You can actually do a lot by customizing a multi-line editbox, as shown here: http://undocumentedmatlab.com/blog/rich-matlab-editbox-contents/ (scroll down until you see the log example and screenshot). All it takes is a little bit of Java magic powder...

For the record, you can also achieve similar results with a listbox

Yair Altman
http://UndocumentedMatlab.com