www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgoptimoutnode/loadobj.m
function Node = loadobj(Node) %LOADOBJ Method to update old versions of output node objects % Copyright 2000-2006 The MathWorks, Inc. and Ford Global Technologies, Inc. if isstruct(Node) && ~isfield(Node, 'version') % Version 1 object structure - nothing to salvage. Node = struct('name', Node.name, ... 'output', [], ... 'version', 3, ... 'cgcontainer', Node.cgcontainer); end if Node.version < 3 % Version 2 object structure - need to add the "first view" field Node.viewed = 0; end if Node.version < 4 % Change to cgoptimoutput object. The actual data stored here is % upgraded by the parent cgoptimnode, which also takes a copy of the % pointer. We will schedule a post-load action here to re-set the name % in the correct way. Date number is 31-August-2005. h = mbcloadrecorder('current'); h.add({@i_setname, address(Node.cgcontainer), Node.name},732555); Node = rmfield(Node, {'name', 'output', 'viewed'}); end if Node.version < 5 % Add a flag that indicates whether the optim node should be overwritten % by subsequent optim runs or not Node.Preserve = false; end % Current version Node.version = 5; if isstruct(Node) Node = cgoptimoutnode(Node); end function i_setname(pProj, evt, pNode, realname) pNode.name(realname);