automatically cycle through function inputs

I want to simplify a function so that I don't have to create multiple loops for each input:
function [] = NAME( a,b,c,d,e,g,e,h,th,sg,r etc..)
for i = (number of inputs??)
figure(i)
plot( automatically cycle through inputs)
end

Answers (1)

use varargin:
function name(varargin)
for i = 1:nargin
figure(i), plot(varargin{1});
end
end

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Asked:

on 24 Jul 2015

Commented:

on 30 May 2019

Community Treasure Hunt

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

Start Hunting!