www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgddnode/convtoconstant.m
function [ok, msg] = convtoconstant(dd, pVar) %CONVTOCONSTANT Convert item to a constant % % [OK, MSG] = CONVTOCONSTANT(DD, PITEM) converts any variable dictionary % item to a constant. % Copyright 2000-2005 The MathWorks, Inc. and Ford Global Technologies, Inc. ok = false; msg = ''; if ~pVar.isconstant mySym = insymval(dd, pVar); if isempty(mySym) oldobj = pVar.info; const = cgconstvalue; const = copybaseinfo(oldobj, const); const = setpoint(const); setaddress(const, pVar); if issymvalue(oldobj) dd.numsymvars = dd.numsymvars - 1; xregpointer(dd); end ok = true; else msg = 'Unable to convert to constant because the item is currently being used by a formula.'; end else % No work to do ok = true; end