MATLAB: How i can have dimension input of a defined function like f

no tags

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)

Best Answer

f=@(x,y)(x+y)
s=func2str(f);
a=regexp(s,'(?<=@\()[\w,]+(?=\))','match')
out=numel(cell2mat(regexp(a,'\w+')))