Help with properties()

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Help with properties()

Rik-4
Can someone provide some more on the classdef implementation by placing the
following code in a file testprop.m


-- START testprop.m --
classdef testprop

    properties
        testprop = 0;
    end

    properties (Access = protected)
        protectedtestprop = 0;
    end

    properties (Hidden = true)
        hiddentestprop = 0;
    end

end
-- END testprop.m --

Then run

-- START code --
x = testprop
properties (x)
-- END code --

and upload the results.  If I understand the documentation, only the
public, non-hidden property will be returned.

--Rik


Reply | Threaded
Open this post in threaded view
|

Re: Help with properties()

nrjank


On Fri, Feb 22, 2019 at 2:07 PM Rik <[hidden email]> wrote:
Can someone provide some more on the classdef implementation by placing the
following code in a file testprop.m


>> x = testprop
Error using testprop
Error: File: testprop.m Line: 4 Column: 9
A property or event may not use the same name as the name of the class (testprop).
 
>> properties (x)
Undefined function or variable 'x'. 
Reply | Threaded
Open this post in threaded view
|

Re: Help with properties()

Rik-4
On 02/22/2019 11:22 AM, Nicholas Jankowski wrote:
> > > On Fri, Feb 22, 2019 at 2:07 PM Rik [hidden email] wrote: > > Can someone provide some more on the classdef implementation by placing the > following code in a file testprop.m > > > >> x = testprop > Error using testprop > Error: File: testprop.m Line: 4 Column: 9 > A property or event may not use the same name as the name of the class (testprop). >
That's a new, but different, incompatibility.  I'll file a bug report about that too.  Can you try this slightly altered code ("testprop" renamed to "tstprop"?

-- START testprop.m --
classdef testprop

    properties
        tstprop = 0;
    end

    properties (Access = protected)
        protectedtestprop = 0;
    end

    properties (Hidden = true)
        hiddentestprop = 0;
    end

end
-- END testprop.m --

Then run

-- START code --
x = testprop
properties (x)
-- END code --

and upload the results.

--Rik


Reply | Threaded
Open this post in threaded view
|

Re: Help with properties()

nrjank


On Fri, Feb 22, 2019 at 4:52 PM Rik <[hidden email]> wrote:
On 02/22/2019 11:22 AM, Nicholas Jankowski wrote:

That's a new, but different, incompatibility.  I'll file a bug report about that too.  Can you try this slightly altered code ("testprop" renamed to "tstprop"?


>> x = testprop
properties (x)
x =
  testprop with properties:
    tstprop: 0

Properties for class testprop:
    tstprop