Classdef test required on Matlab

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

Classdef test required on Matlab

Michael Goffioul
Could someone test the following in Matlab? Put all files into a single dir, then run "runAll".

Thanks,
Michael.


clA.m (316 bytes) Download Attachment
clB.m (142 bytes) Download Attachment
clC.m (258 bytes) Download Attachment
runAll.m (332 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Classdef test required on Matlab

Lukas Reichlin-4
On 19.01.2014, at 17:42, Michael Goffioul <[hidden email]> wrote:

> Could someone test the following in Matlab? Put all files into a single dir, then run "runAll".
>
> Thanks,
> Michael.
>
> <clA.m><clB.m><clC.m><runAll.m>

Here you go :-) R2013a on a Mac.

Cheers,
Lukas

>> runAll
>>> calling aa.getPropFromA
>>> clA::subsref

ans =

    10

>>> calling bb.getPropFromA
>>> clA::subsref

ans =

    10

>>> calling bb.getPropFromB
>>> clA::subsref

ans =

    10

>>> calling cc.getPropFromC
>>> clA::subsref

ans =

    10

>>
Reply | Threaded
Open this post in threaded view
|

Re: Classdef test required on Matlab

steph
In reply to this post by Michael Goffioul
On 2014/01/19 18:42, Michael Goffioul wrote:
> Could someone test the following in Matlab? Put all files into a
> single dir, then run "runAll".
>
> Thanks,
> Michael.
>
Here are the results running Windows 7 on i7 Lenova W520 Matlab R2013b,
and I give the results in good faith. I have done these tests in the
past and after submitting I never got a response?


>> runAll
>>> calling aa.getPropFromA
>>> clA::subsref

ans =

     10

>>> calling bb.getPropFromA
>>> clA::subsref

ans =

     10

>>> calling bb.getPropFromB
>>> clA::subsref

ans =

     10

>>> calling cc.getPropFromC
>>> clA::subsref

ans =

     10

>>

--
---<br/>
<b><i>Steph Bredenhann</i></b> PrEng, PrCPM<br/>
<br/>
<br/>

Reply | Threaded
Open this post in threaded view
|

Re: Classdef test required on Matlab

Michael Goffioul
In reply to this post by Lukas Reichlin-4
On Sun, Jan 19, 2014 at 12:36 PM, Lukas Reichlin <[hidden email]> wrote:
On 19.01.2014, at 17:42, Michael Goffioul <[hidden email]> wrote:

> Could someone test the following in Matlab? Put all files into a single dir, then run "runAll".
>
> Thanks,
> Michael.
>
> <clA.m><clB.m><clC.m><runAll.m>

Here you go :-) R2013a on a Mac.

Cheers,
Lukas

>> runAll
>>> calling aa.getPropFromA
>>> clA::subsref

ans =

    10

>>> calling bb.getPropFromA
>>> clA::subsref

ans =

    10

>>> calling bb.getPropFromB
>>> clA::subsref

ans =

    10

>>> calling cc.getPropFromC
>>> clA::subsref

ans =

    10

>>

Thanks. However, this is rather unexpected. I was reading documentation about overloading subsref [1] and the documentation says that built-in subsref is always called from withing class methods. So unless I'm mis-reading the doc, the first case should at least not have called clA::subsref. This doesn't make sense...

Michael.



Reply | Threaded
Open this post in threaded view
|

Re: Classdef test required on Matlab

fgnievinski
Michael Goffioul wrote
On Sun, Jan 19, 2014 at 12:36 PM, Lukas Reichlin <
[hidden email]> wrote:

> On 19.01.2014, at 17:42, Michael Goffioul <[hidden email]>
> wrote:
>
> > Could someone test the following in Matlab? Put all files into a single
> dir, then run "runAll".
> >
> > Thanks,
> > Michael.
> >
> > <clA.m><clB.m><clC.m><runAll.m>
>
> Here you go :-) R2013a on a Mac.
>
> Cheers,
> Lukas
>
> >> runAll
> >>> calling aa.getPropFromA
> >>> clA::subsref
>
> ans =
>
>     10
>
> >>> calling bb.getPropFromA
> >>> clA::subsref
>
> ans =
>
>     10
>
> >>> calling bb.getPropFromB
> >>> clA::subsref
>
> ans =
>
>     10
>
> >>> calling cc.getPropFromC
> >>> clA::subsref
>
> ans =
>
>     10
>
> >>


Thanks. However, this is rather unexpected. I was reading documentation
about overloading subsref [1] and the documentation says that built-in
subsref is always called from withing class methods. So unless I'm
mis-reading the doc, the first case should at least not have called
clA::subsref. This doesn't make sense...

Michael.


[1]
http://www.mathworks.com/help/matlab/matlab_oop/indexed-reference-and-assignment.html#br09nsm
clA::subsref is being reached directly from runAll, not through method getPropFromA.

modifying subsref as follows:

    function y = subsref (this, S)
      disp('>>> clA::subsref');
      display(dbstack(1))
      display(S)
      y = this.prop;
    end

shows that:

    >>> calling aa.getPropFromA
    >>> clA::subsref
        file: 'runAll.m'
        name: 'runAll'
        line: 5


    S =

        type: '.'
        subs: 'getPropFromA'


    ans =

        10


on the other hand, calling the method explicitly,
does NOT reach the overload subsref, as expected:

    >> getPropFromA(aa)

    ans =

        10

Reply | Threaded
Open this post in threaded view
|

Re: Classdef test required on Matlab

Michael Goffioul
On Sun, Jan 19, 2014 at 10:14 PM, fgnievinski <[hidden email]> wrote:
Michael Goffioul wrote
> On Sun, Jan 19, 2014 at 12:36 PM, Lukas Reichlin <

> lukas.reichlin.lists@

>> wrote:
>
>> On 19.01.2014, at 17:42, Michael Goffioul &lt;

> michael.goffioul@

> &gt;
>> wrote:
>>
>> > Could someone test the following in Matlab? Put all files into a single
>> dir, then run "runAll".
>> >
>> > Thanks,
>> > Michael.
>> >
>> >
> <clA.m>
> <clB.m>
> <clC.m>
> <runAll.m>
>>
>> Here you go :-) R2013a on a Mac.
>>
>> Cheers,
>> Lukas
>>
>> >> runAll
>> >>> calling aa.getPropFromA
>> >>> clA::subsref
>>
>> ans =
>>
>>     10
>>
>> >>> calling bb.getPropFromA
>> >>> clA::subsref
>>
>> ans =
>>
>>     10
>>
>> >>> calling bb.getPropFromB
>> >>> clA::subsref
>>
>> ans =
>>
>>     10
>>
>> >>> calling cc.getPropFromC
>> >>> clA::subsref
>>
>> ans =
>>
>>     10
>>
>> >>
>
>
> Thanks. However, this is rather unexpected. I was reading documentation
> about overloading subsref [1] and the documentation says that built-in
> subsref is always called from withing class methods. So unless I'm
> mis-reading the doc, the first case should at least not have called
> clA::subsref. This doesn't make sense...
>
> Michael.
>
>
> [1]
> http://www.mathworks.com/help/matlab/matlab_oop/indexed-reference-and-assignment.html#br09nsm

clA::subsref is being reached directly from runAll, not through method
getPropFromA.

modifying subsref as follows:

    function y = subsref (this, S)
      disp('>>> clA::subsref');
      display(dbstack(1))
      display(S)
      y = this.prop;
    end

shows that:

    >>> calling aa.getPropFromA
    >>> clA::subsref
        file: 'runAll.m'
        name: 'runAll'
        line: 5


    S =

        type: '.'
        subs: 'getPropFromA'


    ans =

        10


on the other hand, calling the method explicitly,
does NOT reach the overload subsref, as expected:

    >> getPropFromA(aa)

    ans =

        10


Of course. By overloading subsref, I inadvertently killed the dot-notation, so I was actually not calling getPropFromA. Thanks for pointing this out.

Would you mind running the test with this modified runAll.m?

Michael.


Reply | Threaded
Open this post in threaded view
|

Re: Classdef test required on Matlab

Michael Goffioul
On Mon, Jan 20, 2014 at 12:17 AM, Michael Goffioul <[hidden email]> wrote:
On Sun, Jan 19, 2014 at 10:14 PM, fgnievinski <[hidden email]> wrote:
Michael Goffioul wrote
> On Sun, Jan 19, 2014 at 12:36 PM, Lukas Reichlin <

> lukas.reichlin.lists@

>> wrote:
>
>> On 19.01.2014, at 17:42, Michael Goffioul &lt;

> michael.goffioul@

> &gt;
>> wrote:
>>
>> > Could someone test the following in Matlab? Put all files into a single
>> dir, then run "runAll".
>> >
>> > Thanks,
>> > Michael.
>> >
>> >
> <clA.m>
> <clB.m>
> <clC.m>
> <runAll.m>
>>
>> Here you go :-) R2013a on a Mac.
>>
>> Cheers,
>> Lukas
>>
>> >> runAll
>> >>> calling aa.getPropFromA
>> >>> clA::subsref
>>
>> ans =
>>
>>     10
>>
>> >>> calling bb.getPropFromA
>> >>> clA::subsref
>>
>> ans =
>>
>>     10
>>
>> >>> calling bb.getPropFromB
>> >>> clA::subsref
>>
>> ans =
>>
>>     10
>>
>> >>> calling cc.getPropFromC
>> >>> clA::subsref
>>
>> ans =
>>
>>     10
>>
>> >>
>
>
> Thanks. However, this is rather unexpected. I was reading documentation
> about overloading subsref [1] and the documentation says that built-in
> subsref is always called from withing class methods. So unless I'm
> mis-reading the doc, the first case should at least not have called
> clA::subsref. This doesn't make sense...
>
> Michael.
>
>
> [1]
> http://www.mathworks.com/help/matlab/matlab_oop/indexed-reference-and-assignment.html#br09nsm

clA::subsref is being reached directly from runAll, not through method
getPropFromA.

modifying subsref as follows:

    function y = subsref (this, S)
      disp('>>> clA::subsref');
      display(dbstack(1))
      display(S)
      y = this.prop;
    end

shows that:

    >>> calling aa.getPropFromA
    >>> clA::subsref
        file: 'runAll.m'
        name: 'runAll'
        line: 5


    S =

        type: '.'
        subs: 'getPropFromA'


    ans =

        10


on the other hand, calling the method explicitly,
does NOT reach the overload subsref, as expected:

    >> getPropFromA(aa)

    ans =

        10


Of course. By overloading subsref, I inadvertently killed the dot-notation, so I was actually not calling getPropFromA. Thanks for pointing this out.

Would you mind running the test with this modified runAll.m?

And here's the file.

Michael.


runAll.m (336 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Classdef test required on Matlab

Laurent Hoeltgen
On 01/20/2014 06:18 AM, Michael Goffioul wrote:
On Mon, Jan 20, 2014 at 12:17 AM, Michael Goffioul <[hidden email]> wrote:
On Sun, Jan 19, 2014 at 10:14 PM, fgnievinski <[hidden email]> wrote:
Michael Goffioul wrote
> On Sun, Jan 19, 2014 at 12:36 PM, Lukas Reichlin <

> lukas.reichlin.lists@

>> wrote:
>
>> On 19.01.2014, at 17:42, Michael Goffioul &lt;

> michael.goffioul@

> &gt;
>> wrote:
>>
>> > Could someone test the following in Matlab? Put all files into a single
>> dir, then run "runAll".
>> >
>> > Thanks,
>> > Michael.
>> >
>> >
> <clA.m>
> <clB.m>
> <clC.m>
> <runAll.m>
>>
>> Here you go :-) R2013a on a Mac.
>>
>> Cheers,
>> Lukas
>>
>> >> runAll
>> >>> calling aa.getPropFromA
>> >>> clA::subsref
>>
>> ans =
>>
>>     10
>>
>> >>> calling bb.getPropFromA
>> >>> clA::subsref
>>
>> ans =
>>
>>     10
>>
>> >>> calling bb.getPropFromB
>> >>> clA::subsref
>>
>> ans =
>>
>>     10
>>
>> >>> calling cc.getPropFromC
>> >>> clA::subsref
>>
>> ans =
>>
>>     10
>>
>> >>
>
>
> Thanks. However, this is rather unexpected. I was reading documentation
> about overloading subsref [1] and the documentation says that built-in
> subsref is always called from withing class methods. So unless I'm
> mis-reading the doc, the first case should at least not have called
> clA::subsref. This doesn't make sense...
>
> Michael.
>
>
> [1]
> http://www.mathworks.com/help/matlab/matlab_oop/indexed-reference-and-assignment.html#br09nsm

clA::subsref is being reached directly from runAll, not through method
getPropFromA.

modifying subsref as follows:

    function y = subsref (this, S)
      disp('>>> clA::subsref');
      display(dbstack(1))
      display(S)
      y = this.prop;
    end

shows that:

    >>> calling aa.getPropFromA
    >>> clA::subsref
        file: 'runAll.m'
        name: 'runAll'
        line: 5


    S =

        type: '.'
        subs: 'getPropFromA'


    ans =

        10


on the other hand, calling the method explicitly,
does NOT reach the overload subsref, as expected:

    >> getPropFromA(aa)

    ans =

        10


Of course. By overloading subsref, I inadvertently killed the dot-notation, so I was actually not calling getPropFromA. Thanks for pointing this out.

Would you mind running the test with this modified runAll.m?

And here's the file.

Michael.


Hi,
result on Matlab R2012a and R2013a (it's identical in both versions):

>> aa = clA;
bb = clB;
cc = clC;
disp('>>> calling aa.getPropFromA');
getPropFromA(aa)
disp('>>> calling bb.getPropFromA');
getPropFromA(bb)
disp('>>> calling bb.getPropFromB');
getPropFromB(bb)
disp('>>> calling cc.getPropFromC');
getPropFromC(cc)
>>> calling aa.getPropFromA

ans =

    10

>>> calling bb.getPropFromA

ans =

    10

>>> calling bb.getPropFromB

ans =

    10

>>> calling cc.getPropFromC
>>> clA::subsref

ans =

    10

Regards,
Laurent
Reply | Threaded
Open this post in threaded view
|

Re: Classdef test required on Matlab

Michael Goffioul
In reply to this post by steph
On Sun, Jan 19, 2014 at 3:12 PM, Steph Bredenhann <[hidden email]> wrote:
On 2014/01/19 18:42, Michael Goffioul wrote:
Could someone test the following in Matlab? Put all files into a
single dir, then run "runAll".

Thanks,
Michael.

Here are the results running Windows 7 on i7 Lenova W520 Matlab R2013b, and I give the results in good faith. I have done these tests in the past and after submitting I never got a response?



runAll
calling aa.getPropFromA
clA::subsref

ans =

    10

calling bb.getPropFromA
clA::subsref

ans =

    10

calling bb.getPropFromB
clA::subsref

ans =

    10

calling cc.getPropFromC
clA::subsref

ans =

    10




Thanks for running the test. The fact that you didn't receive a response in the past doesn't mean your help isn't appreciated. These little tests are very useful for the development process. Next time I'll make sure to send an ACK e-mail.

Thanks to all of those who ran the tests.

Michael.

Reply | Threaded
Open this post in threaded view
|

Re: Classdef test required on Matlab

Michael Goffioul
On Mon, Jan 20, 2014 at 7:41 AM, Michael Goffioul <[hidden email]> wrote:
On Sun, Jan 19, 2014 at 3:12 PM, Steph Bredenhann <[hidden email]> wrote:
On 2014/01/19 18:42, Michael Goffioul wrote:
Could someone test the following in Matlab? Put all files into a
single dir, then run "runAll".

Thanks,
Michael.

Here are the results running Windows 7 on i7 Lenova W520 Matlab R2013b, and I give the results in good faith. I have done these tests in the past and after submitting I never got a response?



runAll
calling aa.getPropFromA
clA::subsref

ans =

    10

calling bb.getPropFromA
clA::subsref

ans =

    10

calling bb.getPropFromB
clA::subsref

ans =

    10

calling cc.getPropFromC
clA::subsref

ans =

    10






Could anyone run the modified tests (runAll)? Thanks.


 

clA.m (614 bytes) Download Attachment
clB.m (142 bytes) Download Attachment
clC.m (258 bytes) Download Attachment
runAll.m (520 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Classdef test required on Matlab

siko1056
On Mon, Jan 20, 2014 at 4:28 PM, Michael Goffioul <[hidden email]> wrote:

Could anyone run the modified tests (runAll)? Thanks.


>> ver
----------------------------------------------------------------------------------------------------
MATLAB Version: 8.2.0.701 (R2013b)
Operating System: Linux 3.11.0-15-generic #23-Ubuntu SMP Mon Dec 9 18:17:04 UTC 2013 x86_64
Java Version: Java 1.7.0_11-b21 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
----------------------------------------------------------------------------------------------------

>> runAll
>>> calling getPropFromA(aa)

ans =

    10

>>> calling getPropFromA(bb)

ans =

    10

>>> calling getPropFromB(bb)

ans =

    10

>>> calling getPropFromC(cc)
>>> clA::subsref

ans =

    10

>>> calling getPropFromA(dd)
>>> clA::getPropFromA forward to owned object

ans =

    10

>>> calling aaArr(2,2)
>>> clA::subsref

ans =

    10 
Reply | Threaded
Open this post in threaded view
|

Re: Classdef test required on Matlab

Michael Goffioul
On Mon, Jan 20, 2014 at 10:39 AM, Kai Torben Ohlhus <[hidden email]> wrote:
On Mon, Jan 20, 2014 at 4:28 PM, Michael Goffioul <[hidden email]> wrote:

Could anyone run the modified tests (runAll)? Thanks.


>> ver
----------------------------------------------------------------------------------------------------
MATLAB Version: 8.2.0.701 (R2013b)
Operating System: Linux 3.11.0-15-generic #23-Ubuntu SMP Mon Dec 9 18:17:04 UTC 2013 x86_64
Java Version: Java 1.7.0_11-b21 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
----------------------------------------------------------------------------------------------------

>> runAll
>>> calling getPropFromA(aa)

ans =

    10

>>> calling getPropFromA(bb)

ans =

    10

>>> calling getPropFromB(bb)

ans =

    10

>>> calling getPropFromC(cc)
>>> clA::subsref

ans =

    10

>>> calling getPropFromA(dd)
>>> clA::getPropFromA forward to owned object

ans =

    10

>>> calling aaArr(2,2)
>>> clA::subsref

ans =

    10 

Thank you. This confirms my initial thought.

Michael.