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:
strings vector using num2str

Subject: strings vector using num2str

From: RAB John

Date: 29 Aug, 2010 13:03:04

Message: 1 of 2

Hello all,

I wish to use text() and num2str() combination in order to text a graph in multiple point with out the use of a LOOP!
The only problem is num2str() producing one string instead of a strings vector.

The code I tried is:

text(1:2:5, abs(Y((1:2:5) + 1)), num2str(abs(Y((1:2:5) + 1))), '%1.3d'));

where Y is a line vector.

a simillar looped version would be:

for i = 1:2:5
    text(i, abs(Y(i + 1)), num2str(abs(Y(i + 1)), '%1.3d'));
end

Any suggestion?
DK

Subject: strings vector using num2str

From: Oleg Komarov

Date: 29 Aug, 2010 15:43:03

Message: 2 of 2

"RAB John" <dkkddkkd@walla.com> wrote in message <i5dlq8$ogo$1@fred.mathworks.com>...
> Hello all,
>
> I wish to use text() and num2str() combination in order to text a graph in multiple point with out the use of a LOOP!
> The only problem is num2str() producing one string instead of a strings vector.
>
> The code I tried is:
>
> text(1:2:5, abs(Y((1:2:5) + 1)), num2str(abs(Y((1:2:5) + 1))), '%1.3d'));
>
> where Y is a line vector.
>
> a simillar looped version would be:
>
> for i = 1:2:5
> text(i, abs(Y(i + 1)), num2str(abs(Y(i + 1)), '%1.3d'));
> end
>
> Any suggestion?
> DK

Double post.
Oleg

Tags for this Thread

No tags are associated with 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