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:
names of the figures

Subject: names of the figures

From: Jose

Date: 28 Jun, 2010 13:39:23

Message: 1 of 6

Hello guys again, i have a problem with the names of the figure,

If i want to change the name of figure1 for other name is fine:

set(figure(1),'Name','amplitude','Numbertitle','off')...but, muy problem is
that I want to try to put a special name mixture of a string 'amplitude' plus a number:

Example:

a=[5 6 7]

how can I show the names: amplitude a(1),i.e amplitude 5, amplitude a(2), i.e amplitude 6 and amplitude 7 in the figures (1), (2) and (3)?
 I think with the property 'Name' is not possible because
only admit string, and my name is compose for a string=amplitude plus a number=a(x).

Thanks

Subject: names of the figures

From: Andy

Date: 28 Jun, 2010 13:48:21

Message: 2 of 6

"Jose " <jose.l.vega@gmail.com> wrote in message <i0a8mb$2l9$1@fred.mathworks.com>...
> Hello guys again, i have a problem with the names of the figure,
>
> If i want to change the name of figure1 for other name is fine:
>
> set(figure(1),'Name','amplitude','Numbertitle','off')...but, muy problem is
> that I want to try to put a special name mixture of a string 'amplitude' plus a number:
>
> Example:
>
> a=[5 6 7]
>
> how can I show the names: amplitude a(1),i.e amplitude 5, amplitude a(2), i.e amplitude 6 and amplitude 7 in the figures (1), (2) and (3)?
> I think with the property 'Name' is not possible because
> only admit string, and my name is compose for a string=amplitude plus a number=a(x).
>
> Thanks

Use num2str or sprintf.

Subject: names of the figures

From: someone

Date: 28 Jun, 2010 13:50:28

Message: 3 of 6

"Jose " <jose.l.vega@gmail.com> wrote in message <i0a8mb$2l9$1@fred.mathworks.com>...
> Hello guys again, i have a problem with the names of the figure,
>
> If i want to change the name of figure1 for other name is fine:
>
> set(figure(1),'Name','amplitude','Numbertitle','off')...but, muy problem is
> that I want to try to put a special name mixture of a string 'amplitude' plus a number:
>
> Example:
>
> a=[5 6 7]
>
> how can I show the names: amplitude a(1),i.e amplitude 5, amplitude a(2), i.e amplitude 6 and amplitude 7 in the figures (1), (2) and (3)?
> I think with the property 'Name' is not possible because
> only admit string, and my name is compose for a string=amplitude plus a number=a(x).
>
> Thanks

Try something like:

set(figure(1),'Name',['amplitude' num2str(a(1)],'Numbertitle','off')

Subject: names of the figures

From: Jose

Date: 28 Jun, 2010 13:55:11

Message: 4 of 6

"Andy " <theorigamist@gmail.com> wrote in message <i0a975$7dp$1@fred.mathworks.com>...
> "Jose " <jose.l.vega@gmail.com> wrote in message <i0a8mb$2l9$1@fred.mathworks.com>...
> > Hello guys again, i have a problem with the names of the figure,
> >
> > If i want to change the name of figure1 for other name is fine:
> >
> > set(figure(1),'Name','amplitude','Numbertitle','off')...but, muy problem is
> > that I want to try to put a special name mixture of a string 'amplitude' plus a number:
> >
> > Example:
> >
> > a=[5 6 7]
> >
> > how can I show the names: amplitude a(1),i.e amplitude 5, amplitude a(2), i.e amplitude 6 and amplitude 7 in the figures (1), (2) and (3)?
> > I think with the property 'Name' is not possible because
> > only admit string, and my name is compose for a string=amplitude plus a number=a(x).
> >
> > Thanks
>
> Use num2str or sprintf.

Please andy, can you help me with it?

if i use 'Name','XXXX',...everything is a string...how can i use num2str or sprintf as a property instead of Name?

Thanks

Subject: names of the figures

From: Jose

Date: 28 Jun, 2010 13:57:08

Message: 5 of 6

"someone" <someone@somewhere.net> wrote in message <i0a9b4$fle$1@fred.mathworks.com>...
> "Jose " <jose.l.vega@gmail.com> wrote in message <i0a8mb$2l9$1@fred.mathworks.com>...
> > Hello guys again, i have a problem with the names of the figure,
> >
> > If i want to change the name of figure1 for other name is fine:
> >
> > set(figure(1),'Name','amplitude','Numbertitle','off')...but, muy problem is
> > that I want to try to put a special name mixture of a string 'amplitude' plus a number:
> >
> > Example:
> >
> > a=[5 6 7]
> >
> > how can I show the names: amplitude a(1),i.e amplitude 5, amplitude a(2), i.e amplitude 6 and amplitude 7 in the figures (1), (2) and (3)?
> > I think with the property 'Name' is not possible because
> > only admit string, and my name is compose for a string=amplitude plus a number=a(x).
> >
> > Thanks
>
> Try something like:
>
> set(figure(1),'Name',['amplitude' num2str(a(1)],'Numbertitle','off')

Thank youvery much someone!!!

Subject: names of the figures

From: Matt Fig

Date: 28 Jun, 2010 14:34:08

Message: 6 of 6

Also NUM2STR allows format specifiers like SPRINTF, so one could avoid CAT.

set(figure(1),'Name',num2str(a(1),'amplitude %i'),'Numbertitle','off')

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