Hello guys, I met a new problem when I tried to do the calculation of a matrix calculation norm( (8x8x2).* (8x2) )calculation. for the (8x2) is the value that I want to acquire by CVX. However, when I input the equations, the program shows “Error using .* Matrix dimensions must agree.”

But when I move this out of the CVX (I set some default values for the desired matrix), it can calculate successfully.

The formula can be computed without any error, and I’ve checked that for wanted value matrix X and the test matrix has the same lengths.

So I wonder why does this problem happens and how should I do to let the CVX understands that the lengths are matched? Thank you!
Matrix demensions not agree in CVX but okay outside
CVX does not support implicit expansion MATLAB arithmetic expands in R2016b » Loren on the Art of MATLAB - MATLAB & Simulink .
You’ll need to use an appropriate combination of repmat, reshape, and permute in order to form an expression which does not rely on implicit expansion.
Does that resolve your issue?
ones(1,2)+ones(2,1) % relies on implicit expansion
ans =
2 2
2 2
cvx_begin;variables x(1,2) y(2,1);x+y % implicit expansion not used in CVX
Error using +
Matrix dimensions must agree.
