[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Another request for classdef test in Matlab
From: |
Michael D. Godfrey |
Subject: |
Re: Another request for classdef test in Matlab |
Date: |
Sat, 05 Jan 2013 18:27:45 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 |
On 01/05/2013 06:15 PM, Michael Goffioul wrote:
Can you run the same tests when ClassA inherits from handle? That is:
classdef ClassA < handle
properties
x = 1;
end
methods
function obj = ClassA (x)
if nargin > 0
obj.x = x;
end
end
end
end
Result:
>> a(2,2) = ClassA(2)
a =
2x2 ClassA handle
Properties:
x
>> b = a
b =
2x2 ClassA handle
Properties:
x
>> c = a(1,1)
c =
ClassA handle
Properties:
x: 1
>> c.x = 3
c =
ClassA handle
Properties:
x: 3
>> a(1,1).x, b(1,1).x, c.x
ans =
3
ans =
3
ans =
3
>> a(1,1).x = 4
a =
2x2 ClassA handle
Properties:
x
>> a(1,1).x, b(1,1).x, c.x
ans =
4
ans =
4
ans =
4
>>
>> quit
[qss:mgtest04] more ClassA.m
classdef ClassA < handle
properties
x = 1;
end
methods
function obj = ClassA (x)
if nargin > 0
obj.x = x;
end
end
end
end
[qss:mgtest04]
Remember: Matlab is managed by a huge bureaucracy. Getting it right
is not a priority, or even a goal.
mdg
- Re: Another request for classdef test in Matlab, (continued)
- Re: Another request for classdef test in Matlab, Michael Goffioul, 2013/01/04
- Re: Another request for classdef test in Matlab, Michael D. Godfrey, 2013/01/04
- Re: Another request for classdef test in Matlab, Philip Nienhuis, 2013/01/05
- Re: Another request for classdef test in Matlab, Michael Goffioul, 2013/01/05
- Re: Another request for classdef test in Matlab, Michael D. Godfrey, 2013/01/05
- Re: Another request for classdef test in Matlab, Philip Nienhuis, 2013/01/05
- Re: Another request for classdef test in Matlab, Michael Goffioul, 2013/01/05
- Re: Another request for classdef test in Matlab, Michael Goffioul, 2013/01/05
- Re: Another request for classdef test in Matlab,
Michael D. Godfrey <=
- Re: Another request for classdef test in Matlab, Michael Goffioul, 2013/01/05
- Message not available
- Re: Another request for classdef test in Matlab, Michael Goffioul, 2013/01/05
- Re: Another request for classdef test in Matlab, Philip Nienhuis, 2013/01/06
- Re: Another request for classdef test in Matlab, Philip Nienhuis, 2013/01/05