Why in the content of cvx, subs() does not work?

TLDR
I wirte a code to realize SDP problem. I used subs to change syms into numerical value before cvx content and I did see the numerical value after I printed out the variables. But whos() did show that the variable is still syms type which I think might be the key point where I went wrong. The error message shows like this:

Unable to convert ‘cvx’ to ‘sym’.

Details
I’m trying to write a SDP problem looks like follows:

function [res] = NH_SDP(rhot,p,value,t)
dim = size(rhot,1);
for i = 1:p
    drhot(:,:,i) = diff(rhot,t(i));
end
drhot = subs(drhot,t,value);
rhot = subs(rhot,t,value);
rhott = kron(eye(p),rhot);

% cvx process
cvx_begin sdp
%     cvx part
    variable L_ele(dim,dim,(1+p)*p/2) hermitian;
    variable X_ele(dim,dim,p) hermitian;
    cnt = 1;
    for i = 1:p
        for j = i:p
            if i == j
                L((i-1)*dim+1:i*dim,(j-1)*dim+1:j*dim) = L_ele(:,:,cnt);
                cnt = cnt + 1;
            else
                L((i-1)*dim+1:i*dim,(j-1)*dim+1:j*dim) = L_ele(:,:,cnt);
                L((j-1)*dim+1:j*dim,(i-1)*dim+1:i*dim) = L_ele(:,:,cnt);
                cnt = cnt + 1;
            end
        end
    end
    for i = 1:p
        X((i-1)*dim+1:i*dim,1:dim) = X_ele(:,:,i);
    end
    for i = 1:p
        X2(1:dim,(i-1)*dim+1:i*dim) = X_ele(:,:,i);
    end
% rhott = [[0,    0,    0, 0, 0,    0,    0, 0]
% [0,  1/2, 7/20, 0, 0,    0,    0, 0]
% [0, 7/20,  1/2, 0, 0,    0,    0, 0]
% [0,    0,    0, 0, 0,    0,    0, 0]
% [0,    0,    0, 0, 0,    0,    0, 0]
% [0,    0,    0, 0, 0,  1/2, 7/20, 0]
% [0,    0,    0, 0, 0, 7/20,  1/2, 0]
% [0,    0,    0, 0, 0,    0,    0, 0]];
    rhott = double(rhott);
    rhot = double(rhot);
    drhot = double(drhot);
    minimize(trace(rhott*L));
    subject to
%     rhot = [0 0 0 0;0 1/2 7/20 0;0 7/20 1/2 0;0 0 0 0];
%     drhot
        for i =1:p
            trace(rhot*X_ele(:,:,i)) == value(i);
        end
        for i = 1:p
            for j = 1:p
                if i == j
                    trace(drhot(:,:,i)*X_ele(:,:,j)) == 1;
                else
                    trace(drhot(:,:,i)*X_ele(:,:,j)) == 0;
                end
            end
        end
%         semidefinit constraint.
        [L X; X2 eye(dim)] >= 0;
cvx_end
res = cvx_optval;
X_ele
end

There are three line in the above code:

    rhott = double(rhott);
    rhot = double(rhot);
    drhot = double(drhot);

If I delete those three lines, there will be error Unable to convert 'cvx' to 'sym'. while my rhot have already changed into numerical value by subs function and I print it out to see numerical numbers even though whos function show that the type of rhot is still syms.
Any idea? Thanks in advance!

This really isn’t a CVX question. The whos is telling you you have a syms variable instead of double precision. syms variables can’t be used in CVX expressions. If you need help converting syms to double precision, https://www.mathworks.com/matlabcentral/answers/index may be a better place to get that help.