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:
Let's talk about OOP in Matlab

Subject: Let's talk about OOP in Matlab

From: Darik

Date: 18 Mar, 2009 01:50:04

Message: 1 of 3

I've been using Matlab full-time for about 3 years now, and using its new OOP features intensively for about 6 months. It's quite nice, and simplifies a lot of coding, but there's one big glaring oversight in the way Matlab treats arrays of objects. I sat down the other night to write a dorky little rant about it that I could post to the Matlab newsgroup, but it turned into a bit of an essay, complete with citations and sample code, so I made a dorky little blog out of the thing.

You can read it at repmat.blogspot.com as there's too much formatting to post in plaintext. Super executive summary: the fact that Matlab doesn't allow arrays of mixed class/subclass objects is a ***horrible glaring oversight***.

I'd appreciate comments, either here on the newsgroup or on the blog itself.

Subject: Let's talk about OOP in Matlab

From: Yair Altman

Date: 27 Mar, 2009 12:47:01

Message: 2 of 3

"Darik" <dgambleDEL@uwaterlooDEL.caDEL> wrote in message <gppk0c$kk5$1@fred.mathworks.com>...
> I've been using Matlab full-time for about 3 years now, and using its new OOP features intensively for about 6 months. It's quite nice, and simplifies a lot of coding, but there's one big glaring oversight in the way Matlab treats arrays of objects. I sat down the other night to write a dorky little rant about it that I could post to the Matlab newsgroup, but it turned into a bit of an essay, complete with citations and sample code, so I made a dorky little blog out of the thing.
>
> You can read it at repmat.blogspot.com as there's too much formatting to post in plaintext. Super executive summary: the fact that Matlab doesn't allow arrays of mixed class/subclass objects is a ***horrible glaring oversight***.
>
> I'd appreciate comments, either here on the newsgroup or on the blog itself.


Hi Darik,

You can use handle() to concatenate objects, regardless of whether or not they have a common ancestor class. Some of the objects may even be Java/COM/etc.:

[handle(A), handle(B)]

Yair Altman
http://UndocumentedMatlab.com
 

Subject: Let's talk about OOP in Matlab

From: Darik

Date: 28 Mar, 2009 02:23:01

Message: 3 of 3

"Yair Altman" <altmanyDEL@gmailDEL.comDEL> wrote in message <gqihs5$gi5$1@fred.mathworks.com>...
> "Darik" <dgambleDEL@uwaterlooDEL.caDEL> wrote in message <gppk0c$kk5$1@fred.mathworks.com>...
> > I've been using Matlab full-time for about 3 years now, and using its new OOP features intensively for about 6 months. It's quite nice, and simplifies a lot of coding, but there's one big glaring oversight in the way Matlab treats arrays of objects. I sat down the other night to write a dorky little rant about it that I could post to the Matlab newsgroup, but it turned into a bit of an essay, complete with citations and sample code, so I made a dorky little blog out of the thing.
> >
> > You can read it at repmat.blogspot.com as there's too much formatting to post in plaintext. Super executive summary: the fact that Matlab doesn't allow arrays of mixed class/subclass objects is a ***horrible glaring oversight***.
> >
> > I'd appreciate comments, either here on the newsgroup or on the blog itself.
>
>
> Hi Darik,
>
> You can use handle() to concatenate objects, regardless of whether or not they have a common ancestor class. Some of the objects may even be Java/COM/etc.:
>
> [handle(A), handle(B)]
>
> Yair Altman
> http://UndocumentedMatlab.com
>

Yair,

Not sure how that works. If I call handle(MyClass()) I get:

??? Error using ==> handle
Cannot convert to handle.

Even though MyClass is derived from handle.

Am I missing something?

dg

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