Reputation: 626
I'm looking for a command to do something like this: say I have a function
function [] = myfunction(varargin)
then in my code, I would like to to operate on one of the inputs, say input 2, so:
if input(2) == 0
a command similar to input
is what I'm looking for, does it exist?
Upvotes: 1
Views: 151
Reputation: 12345
Do you mean:
if varargin{2} == 0
Or, more robustly
if (nargin>1) && (varargin{2} == 0)
Upvotes: 3