automatically cycle through function inputs

3 次查看(过去 30 天)
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

回答(1 个)

Fabio Freschi
Fabio Freschi 2015-7-24
use varargin:
function name(varargin)
for i = 1:nargin
figure(i), plot(varargin{1});
end
end

类别

Help CenterFile Exchange 中查找有关 MATLAB Report Generator 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by