www.gusucode.com > mbcexpr 工具箱 matlab 源码程序 > mbcexpr/@cgslparser/setname.m

    function setname(obj,ptr,blockname)
%SETNAME set expression name
%
% setname(obj,ptr,blockname)

%  Copyright 2007 The MathWorks, Inc. and Ford Global Technologies, Inc.

if ~strcmp(blockname,ptr.getname)
    % find a unique name
    NewName = obj.Project.uniquename(blockname);

    % table name in project
    A = obj.Project.UpdateConnections;
    index = find(A,'node',ptr);
    if ~isempty(index)
        % table exists so have to be careful that object has unique name
        A.pNode(index).setname(NewName);
    else
        ptr.info = setname(ptr.info,NewName);
    end
end