Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Give a space among text in a plot

Subject: Give a space among text in a plot

From: edward kabanyas

Date: 3 Aug, 2011 02:45:12

Message: 1 of 4

Hi All,
I add some texts with the following code:

hText = text(15, 32, ['a0=', num2str(a0, '%.2f\t')]) ,
hText = text(15, 31, ['a1, b1=', num2str(an(1), '%.2f\t\t'), num2str(bn(1), '%.2f\t' )]) ,
hText = text(15, 30, ['a2, b2=', num2str(an(2), '%.2f\t\t'), num2str(bn(2), '%.2f\t')]) ,

output:
a0=25.95
a1, b1=-3.853.34
a2, b2=2.39-1.45

There is not space between the values, What I hope is:
a0= 25.95
a1, b1= -3.85 3.34
a2, b2= 2.39 -1.45

Do you have experience with such problems ? Thanks for sharing

EDward

Subject: Give a space among text in a plot

From: edward kabanyas

Date: 3 Aug, 2011 03:48:08

Message: 2 of 4

Hi all,

I found, it works with "blanks"

Edward

"edward kabanyas" <djuky_hmi@yahoo.com> wrote in message <j1acno$gk9$1@newscl01ah.mathworks.com>...
> Hi All,
> I add some texts with the following code:
>
> hText = text(15, 32, ['a0=', num2str(a0, '%.2f\t')]) ,
> hText = text(15, 31, ['a1, b1=', num2str(an(1), '%.2f\t\t'), num2str(bn(1), '%.2f\t' )]) ,
> hText = text(15, 30, ['a2, b2=', num2str(an(2), '%.2f\t\t'), num2str(bn(2), '%.2f\t')]) ,
>
> output:
> a0=25.95
> a1, b1=-3.853.34
> a2, b2=2.39-1.45
>
> There is not space between the values, What I hope is:
> a0= 25.95
> a1, b1= -3.85 3.34
> a2, b2= 2.39 -1.45
>
> Do you have experience with such problems ? Thanks for sharing
>
> EDward

Subject: Give a space among text in a plot

From: TideMan

Date: 3 Aug, 2011 04:45:25

Message: 3 of 4

On 3/08/2011 2:45 p.m., edward kabanyas wrote:
> Hi All,
> I add some texts with the following code:
>
> hText = text(15, 32, ['a0=', num2str(a0, '%.2f\t')]) ,
> hText = text(15, 31, ['a1, b1=', num2str(an(1), '%.2f\t\t'),
> num2str(bn(1), '%.2f\t' )]) ,
> hText = text(15, 30, ['a2, b2=', num2str(an(2), '%.2f\t\t'),
> num2str(bn(2), '%.2f\t')]) ,
>
> output:
> a0=25.95
> a1, b1=-3.853.34
> a2, b2=2.39-1.45
>
> There is not space between the values, What I hope is:
> a0= 25.95
> a1, b1= -3.85 3.34
> a2, b2= 2.39 -1.45
>
> Do you have experience with such problems ? Thanks for sharing
>
> EDward
Instead of tabs (i.e., \t) try using preceding spaces: ' %0.2f'

Subject: Give a space among text in a plot

From: edward kabanyas

Date: 3 Aug, 2011 04:55:09

Message: 4 of 4

Hi Tide man,

thanks for reply. it works with "blanks"

Edward

TideMan <nztideman@yahoo.co.nz> wrote in message <j1ajo6$qvo$1@dont-email.me>...
> On 3/08/2011 2:45 p.m., edward kabanyas wrote:
> > Hi All,
> > I add some texts with the following code:
> >
> > hText = text(15, 32, ['a0=', num2str(a0, '%.2f\t')]) ,
> > hText = text(15, 31, ['a1, b1=', num2str(an(1), '%.2f\t\t'),
> > num2str(bn(1), '%.2f\t' )]) ,
> > hText = text(15, 30, ['a2, b2=', num2str(an(2), '%.2f\t\t'),
> > num2str(bn(2), '%.2f\t')]) ,
> >
> > output:
> > a0=25.95
> > a1, b1=-3.853.34
> > a2, b2=2.39-1.45
> >
> > There is not space between the values, What I hope is:
> > a0= 25.95
> > a1, b1= -3.85 3.34
> > a2, b2= 2.39 -1.45
> >
> > Do you have experience with such problems ? Thanks for sharing
> >
> > EDward
> Instead of tabs (i.e., \t) try using preceding spaces: ' %0.2f'

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us