For Programmers: Free Programming Magazines  


Home > Archive > Matlab > March 2006 > "text" function + new line???









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author "text" function + new line???
David Babineau

2006-03-31, 10:03 pm

Hey evetryone,

I know this must be incredibly easy, but I can't figure ouut how to
diplay a text box on a figure with a few lines.

Specifically, I want to diplay the text "potential (mV)" like this:

potential
(mV)

So I wrote:
text(0.298, 0.174, 10.178, 'potential (mV)', 'HorizontalAlignment',
'center');

I tried some variations of the text 'potential (mV)' (, '/n') but
nothing seems to work. I know I could just do two seperate texts but
there must be an easy solution, right?

Thanks in advance,
Dave
Randy Poe

2006-03-31, 10:03 pm


David Babineau wrote:
> Hey evetryone,
>
> I know this must be incredibly easy, but I can't figure ouut how to
> diplay a text box on a figure with a few lines.
>
> Specifically, I want to diplay the text "potential (mV)" like this:
>
> potential
> (mV)
>
> So I wrote:
> text(0.298, 0.174, 10.178, 'potential (mV)', 'HorizontalAlignment',
> 'center');
>
> I tried some variations of the text 'potential (mV)' (, '/n') but
> nothing seems to work. I know I could just do two seperate texts but
> there must be an easy solution, right?


I don't have Matlab up right now but what happens if
you pass a cell array?

text(0.298, 0.174, 10.178, {'potential', '(mV)'}, ...
'HorizontalAlignment', 'center');

I know that works for TITLE.

- Randy

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com