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:
Tab completion methods defined in classdef

Subject: Tab completion methods defined in classdef

From: Simon Preston

Date: 4 Nov, 2009 17:24:02

Message: 1 of 4

Hi all,

I'm starting out with object-oriented programming and have a couple of questions:

i) Methods defined in a classdef declaration are not seen by the 'tab completion' in the command window. Is there a way to get tab completion to 'see' these methods?

ii) I am having trouble overloading the 'plot' function. I have define a function called 'plot' under methods but I get the message 'Conversion to double from xxx is not possible' when I try to call it. If I change the name to something other than 'plot' it works fine. What am I doing wrong?

Thanks for any help.

S

Subject: Tab completion methods defined in classdef

From: Simon Preston

Date: 6 Nov, 2009 12:03:01

Message: 2 of 4

"Simon Preston" <preston.simon+mathsworks@gmail.com> wrote in message <hcsdbi$j1m$1@fred.mathworks.com>...
> Hi all,
>
> I'm starting out with object-oriented programming and have a couple of questions:
>
> i) Methods defined in a classdef declaration are not seen by the 'tab completion' in the command window. Is there a way to get tab completion to 'see' these methods?
>
> ii) I am having trouble overloading the 'plot' function. I have define a function called 'plot' under methods but I get the message 'Conversion to double from xxx is not possible' when I try to call it. If I change the name to something other than 'plot' it works fine. What am I doing wrong?
>
> Thanks for any help.
>
> S

Can anybody help with this?

Thanks, S

Subject: Tab completion methods defined in classdef

From: Peter Perkins

Date: 6 Nov, 2009 16:46:14

Message: 3 of 4

Simon Preston wrote:

> i) Methods defined in a classdef declaration are not seen by the 'tab completion' in the command window. Is there a way to get tab completion to 'see' these methods?
>
> ii) I am having trouble overloading the 'plot' function. I have define a function called 'plot' under methods but I get the message 'Conversion to double from xxx is not possible' when I try to call it. If I change the name to something other than 'plot' it works fine. What am I doing wrong?

Kinda hard to say, in both cases, without seeing your code and usage. Both do work, though.

Subject: Tab completion methods defined in classdef

From: per isakson

Date: 7 Nov, 2009 17:25:02

Message: 4 of 4

"Simon Preston" <preston.simon+mathsworks@gmail.com> wrote in message <hcsdbi$j1m$1@fred.mathworks.com>...
> Hi all,
>
> I'm starting out with object-oriented programming and have a couple of questions:
>
> i) Methods defined in a classdef declaration are not seen by the 'tab completion' in the command window. Is there a way to get tab completion to 'see' these methods?
>
> ii) I am having trouble overloading the 'plot' function. I have define a function called 'plot' under methods but I get the message 'Conversion to double from xxx is not possible' when I try to call it. If I change the name to something other than 'plot' it works fine. What am I doing wrong?
>
> Thanks for any help.
>

With release of Matlab do you use? Both work as documented with R2008a.
i) An instance (object) must exist in the current workspace. Don't forget the dot (e.g. name.) otherwise Matlab looks for a function on the HD, ...
ii) ??? does "methods( myobj )" show the string "plot"? Is the method, plot, public?

/ per

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