f



Can I input multi-line text in Text object?

Dear all
I made a GUI and I want to show some infomation on a 'Text' object. I
tried to use '\n' to fulfill it. However, the Text object cannot
recognize '\n' as a carriage return but a simple text '\n'.
How can I input multi-lines in a text object? Can I?

Any advice will be my pleasure.

Best Regards
damayi
2007-12-21
0
damayi (129)
12/21/2007 5:44:47 AM
comp.soft-sys.matlab 211266 articles. 23 followers. lunamoonmoon (257) is leader. Post Follow

2 Replies
605 Views

Similar Articles

[PageSpeed] 38

damayi schreef:
> Dear all
> I made a GUI and I want to show some infomation on a 'Text' object. I
> tried to use '\n' to fulfill it. However, the Text object cannot
> recognize '\n' as a carriage return but a simple text '\n'.
> How can I input multi-lines in a text object? Can I?
> 
> Any advice will be my pleasure.
> 
> Best Regards
> damayi
> 2007-12-21

Hi Damayi,

I have had several difficulties with this as well. One of the problems 
is that Matlab does not support latex very well in this case. If you did 
not create your text box type:
     h = text('String', {'line' 'line 2'})

In case you have already created the gui, I have found two solutions:
- open guide to edit your gui and open the property inspector for the 
text box. You can edit the string field, including the hard returns. 
However this sometimes gives problems when other text properties are 
changed (such as typeface).
- maybe the best way is to use the command line. If you have already 
prepared your gui and positioned you textbox, then I think you should 
double click on the text box to open the m-file corresponding with the 
gui (I do not have access to matlab at the moment). A new function 
should be created with all the commands to create the text. If this does 
not work, you should use the findobj function to obtain the handle of 
the textbox. Finally you should alter the String property, e.g. by typing:
     set (h, 'String', {'line' 'line 2'})  %with h = handle of textbox


I hope this helps.

Kris
0
12/21/2007 8:23:18 AM
In article <ed8f768b-0723-4f61-9d80-b1fe649ddd42@j20g2000hsi.googlegroups.com>,
damayi  <damayi@gmail.com> wrote:
>Dear all
>I made a GUI and I want to show some infomation on a 'Text' object. I
>tried to use '\n' to fulfill it. However, the Text object cannot
>recognize '\n' as a carriage return but a simple text '\n'.
>How can I input multi-lines in a text object? Can I?

doc text properties

  String

  string

  The text string. Specify this property as a quoted string for
  single-line strings, or as a cell array of strings, or a padded string
  matrix for multiline strings. MATLAB displays this string at the
  specified location. Vertical slash characters are not interpreted as
  line breaks in text strings, and are drawn as part of the text string.
-- 
We regret to announce that sub-millibarn resolution bio-hyperdimensional
plasmatic space polyimaging has been delayed until the release
of Windows Vista SP2.
0
roberson2 (8602)
12/21/2007 5:53:13 PM
Reply: