Warning about `square.m` during CVX installation

WARNING: CVX includes a function
that conflicts with a function of the same name found here:
C:\Program Files\MATLAB\R2012b\toolbox\signal\signal\square.m
If you wish to use this second function, you will need to rename or delete
the CVX version, as it will likely produce different results. This will not
affect the use of SQUARE() within CVX models, because CVX relies on a
different, internal version of SQUARE() when constructing CVX models.

will it effect the normal usage of square function in MATLAB

Sandeep Reddy C

The warning means exactly what it says. If you frequently use the version of square.m supplied by MATLAB’s signal processing toolbox, you should remove the CVX file listed in this message.

I have installed cvx and have not noticed with this warning but now when I am using square_pos or square function, the result is not true. After several search in the forum, I found your previous conversation about square here. Now, how can I fix this problem? I want to replace square.m of MATLAB with the same function of cvx, but I can’t access to the source code of original MATLAB built in function. I removed and installed again cvx but again it was installed without including cvx square function. And now I have the square built in function of MATLAB again which is completely useless for me!

Just use the standard power operation instead; i.e., x^2 instead of square(x).

But I want to use square_pos.m which includes square.m inside. I wanted to change its codes but I was not sure if it affects some other functions which I am using in some other parts of my main optimisation program. Then I thought the best way is to replace square function of MATLAB with square function of cvx.

Just to be clear: if the expression you’re trying to square is a CVX variable, then you will always get the CVX version of square.m. The MATLAB version of square.m only applies to double-precision values. I think you’re safe.