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