You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: warmstart.m
    path of file: ./repos/YALMIP/@sdpvar
    
    the code of the file until where you have to start completion: function warmstart(X,value,ls)
%WARMSTART Assigns a numerical value to an sdpvar
%
% WARMSTART(X,x0) Tries to set the free variables in X so that
%                 value(X)=x0. Notice that other variables
%                 sharing the same free variables will be affected.
%                 If the assignment is infeasible, an error message
%                 will be issued.
%
% WARMSTART(X,x0,1) Least square assignment.
%
% After assigning values to decision variables, these can be communicated
% to the solver as an initial guess by turning on the option 'warmstart' in
% the options structure sent to optimize.


    
function warmstart(X,value,ls)
%WARMSTART Assigns a numerical value to an sdpvar
%
% WARMSTART(X,x0) Tries to set the free variables in X so that
%                 value(X)=x0. Notice that other variables
%                 sharing the same free variables will be affected.
%                 If the assignment is infeasible, an error message
%                 will be issued.
%
% WARMSTART(X,x0,1) Least square assignment.
%
% After assigning values to decision variables, these can be communicated
% to the solver as an initial guess by turning on the option 'warmstart' in
% the options structure sent to optimize.

if nargin<3
    ls = 0;
end

if ~isa(X,'sdpvar')
    error('First argument should be an SDPVAR object.');
end

if isa(value,'logical')
    value = double(value);
end