On the rare occasion that I shadow a Mathworks function, I am hacking a third-party toolbox written for an older MATLAB version, and need to adapt some call that was valid in old MATLAB but not in current MATLAB. Or perhaps a call that was formerly made to a third party routine with the same name as a MATLAB function.
My preference in such cases is generally to change the original source, but if the same issue shows up in a whole bunch of places, sometimes it is easiest to provide a shadow function.
To be honest, when I do provide a shadow function, it is not uncommon that the reason is I have noticed that the person I am responding to has difficulty following change instructions, so I am looking for minimal source code changes, to save on frustration in explaining more proper fixes to the person.
The other notable case of using a shadow function is that I am assisting users who are using third-party libsvm, which uses some of the same function names as the Statistics Toolbox interface to SVM does, but with different arguments. Though in that case I am seldom writing the shadow function: just re-arranging my path so that the libsvm version gets called.
1 Comment
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/339698-which-standard-matlab-functions-do-you-shadow-with-your-own-version-and-why#comment_453151
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/339698-which-standard-matlab-functions-do-you-shadow-with-your-own-version-and-why#comment_453151
Sign in to comment.