function S = validateSessionFile(SessionFileName)
w = warning('off'); %#ok<WNOFF>
[msgOriginal,msgIDOriginal] = lastwarn;
S = load(SessionFileName);
warning(w); lastwarn(msgOriginal,msgIDOriginal);

% validate session file
if isempty(S) ... % session is not empty
        || ~isfield(S,getString(message('Control:mrtool:SessionName'))) ... % Session Variable Name is correct
        || ~isa(S.ModelReducerSession,'mrtool.data.SessionData') % Session Class is correct
    
    [~,FileName,~] = fileparts(SessionFileName);
    error(getString(message('Control:mrtool:InvalidSessionFile',FileName)));
end