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:
Access and manipulate figure via OOP?

Subject: Access and manipulate figure via OOP?

From: Eric

Date: 9 Oct, 2010 06:15:07

Message: 1 of 3

Howdy all!

Is there a way to access a figure and manipulate it via object-oriented programming means?
I'm aware that you can pass the handle to 'get(...)' and 'set(...)', but I was wondering if I would be able to access it directly as an instance of, say, a 'Figure' class.

Something akin to accessing 'datacursormode' in this manner:

dc = datacursormode;
dc.Enable = 'on'; % Not exactly sure if this usage is right though...
disp('Click something');
pause;
index = dc.getCursorInfo().DataIndex; % or .Position

Subject: Access and manipulate figure via OOP?

From: per isakson

Date: 9 Oct, 2010 20:38:03

Message: 2 of 3

"Eric " <eacousineau+mathworks@gmail.com> wrote in message <i8p19b$i45$1@fred.mathworks.com>...
> Howdy all!
>
> Is there a way to access a figure and manipulate it via object-oriented programming means?
> I'm aware that you can pass the handle to 'get(...)' and 'set(...)', but I was wondering if I would be able to access it directly as an instance of, say, a 'Figure' class.
>
> Something akin to accessing 'datacursormode' in this manner:
>
> dc = datacursormode;
> dc.Enable = 'on'; % Not exactly sure if this usage is right though...
> disp('Click something');
> pause;
> index = dc.getCursorInfo().DataIndex; % or .Position

With documemented Matlab - NO.

I would guess that if it is not described at http://undocumentedmatlab.com there is no undocumented way either.

You could certainly wrap handle grafic controls in user defined classes.

/ per

Subject: Access and manipulate figure via OOP?

From: Yair Altman

Date: 10 Oct, 2010 07:28:11

Message: 3 of 3

"Eric " <eacousineau+mathworks@gmail.com> wrote in message <i8p19b$i45$1@fred.mathworks.com>...
> Howdy all!
>
> Is there a way to access a figure and manipulate it via object-oriented programming means?
> I'm aware that you can pass the handle to 'get(...)' and 'set(...)', but I was wondering if I would be able to access it directly as an instance of, say, a 'Figure' class.
>
> Something akin to accessing 'datacursormode' in this manner:
>
> dc = datacursormode;
> dc.Enable = 'on'; % Not exactly sure if this usage is right though...
> disp('Click something');
> pause;
> index = dc.getCursorInfo().DataIndex; % or .Position


hFig = figure(...); % regular figure handle
hhFig = handle(hFig); % handle to a figure class instance
hhFig.Color = 'r';

Yair Altman
http://UndocumentedMatlab.com

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