Need some help with my code

Don’t start off worrying about vectorization, worry about whether the optimization problem is convex. It doesn’t look convex to me.

What you call constraints 1 through 3 are better thought of as being expression assignments (they woould be a total no-go as constraints because nonlinear equality constraints are not allowed by CVX or CVXR).

CVX does have a concave approximation for the log of the standard normal distribution function,log_normcdf. Note that you would use normcdf, not nomrpdf, in MATLAB because \Phi is the cdf, not pdf of a standard Normal. However, \sigma_j is a concave function of x_{ij} and I don’t believe that (C_j - \mu)/\sigma_j would be a concave argument needed to use log_normcdf. So even though you could take the log of the objective function, I believe you are out of luck with \Phi((C_j - \mu_j)/\sigma_j) in CVX and I suspect all other DCP type modeling toolds such as CVXR.

If you can come up with a convex formulation of your problem, or at least a good enough convex approximation, then perhaps you could use CVX. Otherwise, you may need to use a non-convex optimizer.

help log_normcdf

log_normcdf Logarithm of the cumulative normal distribution.
Y = log_normcdf(X) is the logarithm of the CDF of the normal
distribution at the point X.

                             1    / x
    log_normcdf(X) = LOG( ------- |   exp(-t^2/2) dt )
                          sqrt(2) / -Inf

For numeric X, log_normcdf(X) is computed using the equivalent 
expression LOG(0.5*ERFC(-X*SQRT(0.5))). When X is a CVX variable, a 
a piecewise quadratic *approximation* is employed instead. This
approximation gives good results when -4 <= x <= 4, and will be
improved in future releases of CVX.

For array values of X, the log_normcdf returns an array of identical
size with the calculation applied independently to each element.

X must be real.

Disciplined convex programming information:
    log_normcdf is concave and nondecreasing in X. Therefore, when used
    in CVX specifications, X must be concave.

help cvx.max

Disciplined convex/geometric programming information:
    max is convex, log-log-convex, and nondecreasing in its first 
    two arguments. Thus when used in disciplined convex programs, 
    both arguments must be convex (or affine). In disciplined 
    geometric programs, both arguments must be log-convex/affine.