octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Classdef Matlab test


From: Laurent Hoeltgen
Subject: Re: Classdef Matlab test
Date: Wed, 22 May 2013 22:01:00 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130510 Thunderbird/17.0.6

On 22/05/13 21:53, Michael Goffioul wrote:
Could anyone test the following for me? Let's say you have the following
class:

ClassA.m:

classdef ClassA
   properties
     y = 10;
   end
end

Then at matlab prompt:

x = ClassA()
x(2,2).y = 20
x.y

z(2,2) = ClassA()
z(2,2).y = 20
z.y

Thanks,
Michael.


Hi,

I get the following output:

>> x = ClassA()

x =

  ClassA

  Properties:
    y: 10

  Methods

>> x(2,2).y = 20

x =

  2x2 ClassA

  Properties:
    y

  Methods

>> x.y

ans =

    10


ans =

    10


ans =

    10


ans =

    20

>> z(2,2) = ClassA()

z =

  2x2 ClassA

  Properties:
    y

  Methods

>> z(2,2).y = 20

z =

  2x2 ClassA

  Properties:
    y

  Methods

>> z.y

ans =

    10


ans =

    10


ans =

    10


ans =

    20

>>


Running MATLAB R2012a.

Regards,
Laurent


reply via email to

[Prev in Thread] Current Thread [Next in Thread]