automatically cycle through function inputs
5 次查看(过去 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
0 个评论
回答(1 个)
Fabio Freschi
2015-7-24
use varargin:
function name(varargin)
for i = 1:nargin
figure(i), plot(varargin{1});
end
end
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!