[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
more on inline
From: |
John W. Eaton |
Subject: |
more on inline |
Date: |
Thu, 16 Sep 2004 11:15:33 -0400 |
On 16-Sep-2004, Teemu Ikonen <address@hidden> wrote:
| Matlab:
| >> ff = inline('f(x)', 'f', 'x')
| ff =
| Inline function:
| ff(f,x) = f(x)
| >> ff(@sin, 1)
| ans =
| @sin
| >> version
| ans =
| 6.5.0.180913a (R13)
I think this has changed. In R13, function handles were an array
type, so indexing them picked an element from the array. In R14, they
made them a scalar type only, so indexing them performs a function
call. So in the above, you are selecting the first element of the
function handle array stored in f. Try
ff (@sin, 2)
and see if you don't get a different result (range error on the
index).
With the new behavior, I would expect Matlab to be compatible with the
current Octave behavior and call the sin function through the function
handle with the argument 1.
jwe
- more on inline, Teemu Ikonen, 2004/09/16
- more on inline,
John W. Eaton <=