Varargin - mistake in my example
Show older comments
Hi everyone, I wrote the following function:
function [x] = ingressi_arbitrari(varargin)
x=0;
for k=1:nargin
x=x+1;
end
end
Why if I run a=ingressi_arbitrari([2 3]) in the command window, the result is a=1 instead of a=2 (I choose two input arguments)?
Thank you very much.
Accepted Answer
More Answers (1)
Andrei Bobrov
on 13 May 2017
use:
ingressi_arbitrari(2,3)
Categories
Find more on Get Started with MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!