Also, any way to suppress this particular warning without making changes to cvx itself? Other warnings that may arise from e.g. my own code should still be visible though.
I think you can suppress just that particular warning per https://www.mathworks.com/help/matlab/matlab_prog/suppress-warnings.html . I believe this should work on CVX invocations if you suppress the warning at the MATLAB command line. But you would be suppressing all instances of that warning, in or outside CVX, at least until you unsuppress it.
That’s actually not the master repository; I just haven’t pushed there in awhile… There is no doubt that CVX development has slowed considerably. But I believe I pushed a fix for this for 2.1, at least…
It seems you created a new function called narginchk().
Now the problem a function of MathWorks (Built In MATLAB Function) called makehgtform(varargin) is calling narginchk(ai,inf); on its 44 line.
The function is used for Handlers of the Legend in any Figure of MATLAB and your function creates an error and the Legends becomes wrong.
Actually when CVX is added to MATLAB’s path, this is the result:
Warning: Function narginchk has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.
The only solution now is to manually (Or in the script) remove CVX from the MATLAB Path.
Needless to say it is a bad user experience.
The reason I’m asking is this: my replacement narginchk is not supposed to be added to the MATLAB path if the built-in version already exists—in other words, effectively not for any recent version of MATLAB.
That’s great. Now the mystery to me is why the CVX version is being added to your path in the first place. It shouldn’t be: cvx_setup should see that narginchk is already available and should not add it to the path.
@mcg, It seems to be my bad.
I don’t like having lot of folders in my path.
Hence what I do is I run setup and then remove folders added by CVX from MATLAB’s Path (Restores the original path).
Then, whenever there is a script which uses CVX I add all CVX folder to path.
Now that I understand the problem I just removed that file and everything works!
Sorry for the trouble I caused.
Your approach would work if, instead of adding all of CVX’s folders to your path, you add just the ones that CVX itself adds during the cvx_setup process.