function saveToFile(this, file)
%

%   Copyright 2013-2020 The MathWorks, Inc.

    if slavteng('feature','BusParameterTuning')
        params = this.getFlatListOfParams();
    else
        params = this.getStructForSave();
    end
    comments = {};
    flds = {};
    if ~isempty(params) && ~slavteng('feature','BusParameterTuning')
        flds = fields(params);
    elseif ~isempty(params) && slavteng('feature','BusParameterTuning')
        flds = {params.name};
    end
    for i = 1:length(flds)
        if ~this.isParamUsedInAnalysis(flds{i})
            comments{end+1} = flds{i}; %#ok<AGROW>
        end
    end
    %Write params structure to file
    Sldv.ParameterTuning.Manager.writeToParamsFile(file, params, comments);
end
