MATLAB: Undocumented features and future releases

inpudlg()undocumented

I am considering making changes to the inputdlg command, and I understand this can be done by copying the function to my own library (together with setdefaultbutto n & getnicedialoglocatio n) and changing it there (I change the function name, so that the usual inputdlg can still be used). My concern is about future releases of MATLAB, that might change some internal stuff and make the function un-usable (while I will not be around to fix it), e.g. by changing soemthing in those accompanying functions I put in boldface, or the like.
I would appreciate your thoughts, especially if you have some past experience with release upgrades.

Best Answer

Programs are not stable or reliable, when the interpreter changes. For a trustworthy program any dependecies to undocumented functions of Matlab are forbidden, except if you force the customers to use a specific Matlab release. If this is not possible, and there are a lot of reasons to allow the usage of newer versions, automatic tests and fallbacks increase the stability.
In your case a short check (e.g. the very fast MEX-function FEX: isMatlabVer, which is more powerful and takes less time then Matlabs verLessThen) of the Matlab version can branch eitehr to your modified code, or to the standard inputdlg, when the used version is not contained in a list of tested versions.
Even documented features can change with the Matlab release, e.g. the order of elements in unique, setdiff etc., or the behavior of strncmp . Therefore exhaustive unit-tests and integrations-tests are required for a reliable program. Unfortunately it is not possible to test all assumptions about the built-in functions and there have been substantial changes in Matlab in the past. But a serious programmer can at least try to create an exhaustive test suite. By the way, such tests can reveal incompatibilities even for a Matlab version, which has been tested already: Some users might use modified versions of built-in function or re-coded functions of toolboxes, they do not own like nanmean etc.