What might be the problem?


it says that “The number or type of input or output for function ‘vec’ is incorrect.” But i do not understand where this vec comes from.

First of all, make sure you are using CVX 2.2.2 or CVX 2.2, not CVX 3.0beta.

Perhaps there is a conflicting version of vec in your MATLAB path.
What does
which -all vec
show?

I am using cvx 2.2


and this is the result for which -all vec

I don’t know why you are encountering this.

Things to try:

New MATLAB session.

Rerunning cvx_setup with newly downloaded version of CVX. You might as well install CVX 2.2.2 Announcement: CVX 2.2.2, the first "full" open-source release, which has just been released.

I get for which -all vec

which -all vec
C:\mysoftware\cvx-w64\cvx\functions@cvx\vec.m % cvx method
C:\Program Files\MATLAB\R2024a\toolbox\shared\msblks_measurement\msblks_measurement@eyeDiagramSI\vec.p % eyeDiagramSI method

is this the ‘conflict’ with using the wrong vec?

I think
C:\mysoftware\cvx-w64\cvx\functions@cvx\vec.m % cvx method
is what CVX should be using, so I don 't see what the problem is.

C:\Program Files\MATLAB\R2024a\toolbox\shared\msblks_measurement\msblks_measurement@eyeDiagramSI\vec.p % eyeDiagramSI method
is after it in the path, so I would have thought it would be o.k. But obviously something’s not right, so perhaps you can try removing it from the path and see what happens.

I made a file vec.m in my working folder with:
function x = vec(X)
x = X(:);

So this would be the first in the path. This fixed the problem.
I read through the @cvx\vec.m file in cvx and I could not understand it as it does ‘nothing’.
And, where it is called is what causes the problem, i.e… in sparsify\replcals
I put a keyboard there and ran the code to see what happens before, and the use of vec there does not work, i.e. the cvx vec does not work.

In any case, I seem to have a fix, but this seems to be a strange fix.

1 Like

I am also receiving the same error in 2024a when trying to model any optimizations with log_det or det_rootn.

I fixed it by creating a new “vec” function, and rerunning cvx_setup. But it’s a hack.

It’s works!Thank you very much!