[Top][All Lists]

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

Re: Number of arguments of a fcn handle

From: Michael Goffioul
Subject: Re: Number of arguments of a fcn handle
Date: Mon, 7 Oct 2013 09:04:36 -0400

On Sat, Oct 5, 2013 at 5:31 AM, marco Vassallo <address@hidden> wrote:
Hi all,
 In my DLD function I receive a function handle from the user and I need to check the number of arguments
(f = @(x, y) x*y has 2 arguments, f = @(x) sin (x) has 1 argument and so on)

 How can I do it?

This looks to me like a bad idea, but here are some clues anyway.

First, I believe this is only possible of the handle points to a user function. If it points to a DLD (or builtin function), there's no way to know how many arguments the function accepts. But in case, this is a user function, then you could use:


But then you would also need to take into account that the argument list can contain varargin, which hides the actual number of arguments accepted by a function.


reply via email to

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