function FigNum=rp_VersionCompatibleFig(Fig)
% Version compatibility function
% Written by Li Zi-Qi and Jia Xi-Ze 191112.
% Shirui technology co., LTD
% Center for Cognition and Brain Disorders, Hangzhou Normal University, Hangzhou 310015, China
MatlabVersion=sscanf(version,'%d.%d.%d.%d%s');
if (MatlabVersion(1)*1000+MatlabVersion(2)>=8*1000+4) && ~isnumeric(Fig)
    FigNum=Fig.Number;
    if isempty(FigNum)
        FigNum=-0.1;
    end
else
    FigNum=Fig;
end