Skip to content

Commit

Permalink
update for R2020b
Browse files Browse the repository at this point in the history
  • Loading branch information
thrynae committed Sep 28, 2020
1 parent 1a3fbef commit f5a76cf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion README.md
@@ -1,3 +1,5 @@
[![View ifversion on File Exchange](https://www.mathworks.com/matlabcentral/images/matlab-file-exchange.svg)](https://www.mathworks.com/matlabcentral/fileexchange/69138-ifversion)

This minitool helps you determine the version of Matlab (or Octave) that is running your code. This is helpful when imposing a minimum version requirement, or when different versions need different methods to reach the same end result. By using persistent variables this will stay fast even with repeated calls.

You shouldn't use a logical test with v=version;v=str2double(v(1:3)); as it is incomplete for several releases (like e.g. 7.14 or in the future 10.1). That also includes the potential for float rounding errors.
Expand All @@ -6,7 +8,7 @@ You shouldn't use a logical test with v=version;v=str2double(v(1:3)); as it is i
ifversion('>=','R2009a') % returns true when run on R2009a or later
ifversion('<','R2016a') % returns true when run on R2015b or older
ifversion('==','R2018a') % returns true only when run on R2018a
ifversion('==',9.8) % returns true only when run on R2020a
ifversion('==',9.9) % returns true only when run on R2020b
ifversion('<',0,'Octave','>',0) % returns true only on Octave

Licence: CC by-nc-sa 4.0
12 changes: 6 additions & 6 deletions ifversion.m
Expand Up @@ -22,7 +22,7 @@
% ifversion('>=','R2009a') returns true when run on R2009a or later
% ifversion('<','R2016a') returns true when run on R2015b or older
% ifversion('==','R2018a') returns true only when run on R2018a
% ifversion('==',9.8) returns true only when run on R2020a
% ifversion('==',9.9) returns true only when run on R2020b
% ifversion('<',0,'Octave','>',0) returns true only on Octave
%
% The conversion is based on a manual list and therefore needs to be updated manually, so it might
Expand All @@ -32,7 +32,7 @@
% _______________________________________________________________________
% | Compatibility | Windows 10 | Ubuntu 20.04 LTS | MacOS 10.15 Catalina |
% |---------------|-------------|------------------|----------------------|
% | ML R2020a | works | not tested | not tested |
% | ML R2020b | works | not tested | not tested |
% | ML R2018a | works | works | not tested |
% | ML R2015a | works | works | not tested |
% | ML R2011a | works | works | not tested |
Expand All @@ -41,11 +41,11 @@
% | Octave 4.4.1 | works | not tested | works |
% """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
%
% Version: 1.0.2
% Date: 2020-05-20
% Version: 1.0.4
% Date: 2020-09-28
% Author: H.J. Wisselink
% Licence: CC by-nc-sa 4.0 ( creativecommons.org/licenses/by-nc-sa/4.0 )
% Email= 'h_j_wisselink*alumnus_utwente_nl';
% Email = 'h_j_wisselink*alumnus_utwente_nl';
% Real_email = regexprep(Email,{'*','_'},{'@','.'})

%The decimal of the version numbers are padded with a 0 to make sure v7.10 is larger than v7.9.
Expand Down Expand Up @@ -73,7 +73,7 @@
'R2009a' 708;'R2009b' 709;'R2010a' 710;'R2010b' 711;'R2011a' 712;'R2011b' 713;...
'R2012a' 714;'R2012b' 800;'R2013a' 801;'R2013b' 802;'R2014a' 803;'R2014b' 804;...
'R2015a' 805;'R2015b' 806;'R2016a' 900;'R2016b' 901;'R2017a' 902;'R2017b' 903;...
'R2018a' 904;'R2018b' 905;'R2019a' 906;'R2019b' 907;'R2020a' 908};
'R2018a' 904;'R2018b' 905;'R2019a' 906;'R2019b' 907;'R2020a' 908;'R2020b',909};
end

if octave
Expand Down

0 comments on commit f5a76cf

Please sign in to comment.