function ArgsOut = argname2sysname(ArgsIn,ArgNames)
% ARGNAME2SYSNAME
% Helper function which assigns the ArgNames(K) to ArgsIn(k).Name if
% ArgsIn(k) is a LTI object. Used for functions such as
% step, bode and etc.

%   Copyright 1986-2011 The MathWorks, Inc. 

ArgsOut = cell(size(ArgsIn));

for ct = 1:length(ArgsIn)
    argj = ArgsIn{ct};
    if (isa(argj,'DynamicSystem') || isa(argj,'iddata')) && isempty(argj.Name)
        argj.Name = ArgNames{ct};
    end
    ArgsOut{ct} = argj;
end
   