function InputNameOutputNameCode = utGetInputNameOutputNameCode(inputVarNames,outputVarNames)
% GETINPUTNAMEOUTPUTNAMECODE get code for InputName and OutputName for
% MATLAB code generation

%   Copyright 2023 The MathWorks, Inc.

if ~isempty(inputVarNames)
   inputName = ['{''',inputVarNames{1}];
   if numel(inputVarNames) > 1
      for i = 2:1:numel(inputVarNames)
         inputName = append(inputName,''',''',inputVarNames{i});
      end
      inputName = append(inputName,'''}');
   else
      inputName = [inputName '''}'];
   end
   %InputNameCode = append('''InputName''',',',inputName);
   InputNameCode = append(sprintf(' InputName = %s',inputName));
else
   %InputNameCode = append('''InputName''',',','{}');
   InputNameCode = ' InputName = {}';
end

if ~isempty(outputVarNames)
   outputName = ['{''',outputVarNames{1}];
   if numel(outputVarNames) > 1
      for i = 2:1:numel(outputVarNames)
         outputName = append(outputName,''',''',outputVarNames{i});
      end
      outputName = append(outputName,'''}');
   else
      outputName = [outputName '''}'];
   end
   %OutputNameCode = append('''OutputName''',',',outputName);
   OutputNameCode = append(sprintf(' OutputName = %s',outputName));
else
   %OutputNameCode = append('''OutputName''',',','{}');
   InputNameCode = ' OutputName = {}';
end


if isempty(inputVarNames) && isempty(outputVarNames)
   InputNameOutputNameCode = "";
else
   InputNameOutputNameCode = [',',InputNameCode,',',OutputNameCode];
end

end