The function I want to implement is to know if the current version of MATLAB is at least the latest as R2014a .
Is there a reliable, supported way to perform this check?
(With "reliable, supported", I want to say that I am not interested in fragile hacks, such as parsing a string, a returned version, etc.)
BTW, in this case, the reason I want this check is to know that I can use the matlab.lang.makeUniqueStrings function. If there was a reliable, supported way to check for the existence of this function, I would use it instead of checking that the current MATLAB is fairly recent. Unfortunately, there seems to be no such check: exist returns false for every option I can find for the name of this function. Again, I can think of fragile hacks to emulate the right test (for example, which('matlab.lang.makeUniqueStrings') ), but they are hardly better than the version checking versions I mentioned above.
The best solution I've found is to run the command with matlab.lang.makeUniqueStrings in a try-catch . It's still fragile to hack because MATLAB does not offer a reliable built-in way to detect certain exceptions!
IOW, all about choosing the least terrible hack. Testing that the current version is recent enough (even if this test is a fragile hack), at least tends to be general enough to stick to some function and at least contain the distribution of fragile, hacked code.
matlab
kjo
source share