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:
How do I set an axes' properties

Subject: How do I set an axes' properties

From: Abdel

Date: 18 Apr, 2009 19:47:01

Message: 1 of 4

I want to change properties of an axes I get using subplot, but it doesn't work.

    active.NextPlot = 'add';
    active.XLim = [0 display_duration];
    active.YLim = [-11 11];
    active.Title = 'mytitle';
    P(i) = subplot(total_channels,1,i);
    set(P(i), active);

I get the following error:
??? Error using ==> set
Value must be a handle.

Why is that? Do I always have to use "set" for each property and never a structural form?

Subject: How do I set an axes' properties

From: Gustavo Morales

Date: 25 Apr, 2009 06:34:04

Message: 2 of 4

"Abdel":

Hi !!!
Everything you've wrote is ok, except for this:
> active.Title = 'mytitle';

Your error is because "Title" is not a property for an "axes object"
If your subplot axes handle is P(i), type at the command window:

> set(P(i))

and you'll see all the adjustable properties of the object referenced by P(i)

Subject: How do I set an axes' properties

From: Pekka Kumpulainen

Date: 25 Apr, 2009 08:18:03

Message: 3 of 4

"Gustavo Morales" <gustavo.morales.2000@gmail.com> wrote in message <gsuass$r0s$1@fred.mathworks.com>...
> "Abdel":
>
> Hi !!!
> Everything you've wrote is ok, except for this:
> > active.Title = 'mytitle';
>
> Your error is because "Title" is not a property for an "axes object"
> If your subplot axes handle is P(i), type at the command window:
>
> > set(P(i))
>
> and you'll see all the adjustable properties of the object referenced by P(i)

Actually, Title is a property of axes object. But a string is not valid value for title, its value should be a handle of a text object. Just as the error message says.
This should do it:
active.Title = text('String','mytitle');

Subject: How do I set an axes' properties

From: Gustavo Morales

Date: 25 Apr, 2009 14:55:03

Message: 4 of 4

"Pekka Kumpulainen" :
> Actually, Title is a property of axes object. But a string is not valid value for title, its value should be a handle of a text object. Just as the error message says.
> This should do it:
> active.Title = text('String','mytitle');

Thanks for the observation! Title of course is an axes property: a handle for a text object, but the command:

title('String','MyString');

causes the error: {Incorrect number of input arguments} because "title" (I think) is expecting or an axes handle as its first argument (instead of a property name like 'String') or is expecting properly the personal string 'MyString' one want to set. So the code could be:

active.Title = title('MyString');

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