[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: help needed to understand handles to classdef methods
From: |
CROZIER Richard |
Subject: |
Re: help needed to understand handles to classdef methods |
Date: |
Mon, 25 Feb 2019 21:59:12 +0000 |
On 25/02/2019 20:52, John W. Eaton wrote:
> x = method_handle ()
> x.bar (1)
> x.bar (2)
> x.bar (3)
> [h1, h2, h3] = x.get_handles ()
> h1 (x, 1)
> h2 (x, 2)
> h3 (x, 3)
> x.h1 (1)
> x.h2 (2)
> x.h3 (3)
R2018b
>> x = method_handle ()
x.bar (1)
x.bar (2)
x.bar (3)
[h1, h2, h3] = x.get_handles ()
h1 (x, 1)
h2 (x, 2)
h3 (x, 3)
x.h1 (1)
x.h2 (2)
x.h3 (3)
x =
method_handle with no properties.
ans =
'method_handle.foo: 1'
ans =
'method_handle.foo: 2'
ans =
'method_handle.foo: 3'
h1 =
function_handle with value:
@foo
h2 =
function_handle with value:
@(self,n)self.foo(n)
h3 =
function_handle with value:
@(~,n)self.foo(n)
ans =
'method_handle.foo: 1'
ans =
'method_handle.foo: 2'
ans =
'method_handle.foo: 3'
Undefined function 'foo' for input arguments of type 'double'.
>>
The University of Edinburgh is a charitable body, registered in Scotland, with
registration number SC005336.