how i can have dimension input of a defined function like f ?

1 visualización (últimos 30 días)
i have a code that input of its a handle function like f, in duration of this code i need to number of input this function for example f is: f=@(x,y)(x+y)

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 1 de Jul. de 2015
Editada: Azzi Abdelmalek el 1 de Jul. de 2015
f=@(x,y)(x+y)
s=func2str(f);
a=regexp(s,'(?<=@\()[\w,]+(?=\))','match')
out=numel(cell2mat(regexp(a,'\w+')))

Más respuestas (1)

Walter Roberson
Walter Roberson el 2 de Jul. de 2015
f = @(x,y)(x+y)
out = nargin(f)

Categorías

Más información sobre Clocks and Timers en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by