|
From: | Ben Abbott |
Subject: | Re: Classdef Matlab test |
Date: | Thu, 23 May 2013 00:26:34 +0000 (GMT) |
On Wed, May 22, 2013 at 4:01 PM, Laurent Hoeltgen <address@hidden> wrote:Hi,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.
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,
LaurentThanks. Could you also try this variant?ClassA.m:classdef ClassApropertiesy;endendAt prompt:x = ClassA()x(2,2).y.a = 10z(2,2) = ClassA()z(2,2).y.a = 10Michael.
[Prev in Thread] | Current Thread | [Next in Thread] |