How to pre-allocate S1 variable to make my program faster , without declaring new cvx variable?
Are you essentially flattening what would naturally be a 2D matrix into a vector? If so, How about trying to create a 2D matrix via vectorized calculations, then either vec it, or use it as a 2D matrix if that works out.
Also, in the future, instead of posting an image of your code, please copy and paste the code as text, and use the Preformatted text icon. That allows readers trying to help you to copy and paste your code into their MATLAB sessions.
S1 is a matrix that holds some of the entries of the unknown theta, if a pre-allocate S1 as a double im having the error cvx variable can not be assigned to double
Either create it in a vectorized way or, if you have to “preallocate”, use expression holders http://cvxr.com/cvx/doc/basics.html#assignment-and-expression-holders in order to avoid that error.
how to create it in a vectorized way and will that have any impact on my previous issue cvx variable can not be assigned to double
