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
답변 (1개)
Fabio Freschi
2015년 7월 24일
use varargin:
function name(varargin)
for i = 1:nargin
figure(i), plot(varargin{1});
end
end
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!