function fileName = getUniqueFileName(baseName,addtxt)
%GETUNIQUEFILENAME returns a unique file name by appending ADDTXT to
%BASENAME

% Copyright 2020 The MathWorks, Inc.

baseName = [baseName,addtxt];
fileName = baseName;
counter = 1;

% Add number suffix if a model of this name already exists.
while (exist(fileName)==4) % Existing Simulink model name
  fileName = [baseName, num2str(counter)];
  counter=counter+1;
end