octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: concatenation bug?


From: Christopher Hulbert
Subject: Re: concatenation bug?
Date: Thu, 12 Apr 2007 15:55:02 -0400

On 4/12/07, John W. Eaton <address@hidden> wrote:
Is there some reason that the following must fail?

  x = {1, 2};
  [x, @sin]
  error: concatenation operator not implemented for `cell' by `function handle' 
operations

It seems that Matlab barfs on this as well, but I don't see why.

I'm not sure either. It seems that Matlab tries to evaluation the
function handle in the concatenation? Note that the following will
work in Matlab (not sure if this is exactly what you want though).

x=1;y=2;args={x,y};
args={args{:},@sin}

args =

   [1]    [2]    @sin

test=@(x,y,f) f(x*2*pi+y);
test(args{:})

ans =

   0.9093



The reason I want to use it is to do something like this:

  args = {x, y};
  args = [args, @somefun];
  anotherfun (args{:});

Note that the following does work in Matlab:

  args = address@hidden;
  args = [args, pi/2];
  feval (args{:});

jwe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]