From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: What's new in release 2010a?
Date: Tue, 16 Mar 2010 21:30:32 +0000 (UTC)
Organization: TACT Computer Systems Ltd
Lines: 19
Message-ID: <hnot9n$34o$>
References: <hm5f0s$53r$> <hmih5e$593$> <hmjcto$bdv$> <hmlapl$6e4$> <> <hmqkhk$92j$> <hmqm1a$cnv$> <hn9co5$gcs$> <hnor5d$smu$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1268775032 3224 (16 Mar 2010 21:30:32 GMT)
NNTP-Posting-Date: Tue, 16 Mar 2010 21:30:32 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 642467
Xref: comp.soft-sys.matlab:617403

> Still can't get multiple lines of text on a static guide text object.  I tried using a cell array of strings (actually using the java example in cell help & using the more difficult cellstr function) in the static text create function but it doesn't work.

Multi-line text labels are unsupported in the standard uicontrols, but you can use simple Java controls and HTML line-breaks for this:

jLabel = javax.swing.JLabel('<html>This is a long<br>multi-line string');
[jhLabel,hcontainer] = javacomponent(jLabel,[10,10,100,30],gcf);

If your multiple lines are stored in a cell-array, you can convert this into a multi-line HTML string as follows:

strs = {'very long','multi-line','string'};
htmlStr = sprintf('<html>%s%s', sprintf('%s<br>',c{1:end-1}), c{end});
jLabel = javax.swing.JLabel(htmlStr);
[hcomponent,hcontainer] = javacomponent(jLabel,[10,50,50,20],gcf);

More about using HTML in Matlab labels:

Yair Altman