www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgsurfview/@inputlist/pUpdateTable.m

    function pUpdateTable(obj)
%PUPDATETABLE Refresh the input table with the current variables' data 
%
%  PUPDATETABLE(OBJ) redraws the input editing table with the values that
%  are currently stored for the variable list.
%
%  You should ensure that pUpdateVarTypes has been called before using this
%  method.

%  Copyright 2000-2005 The MathWorks, Inc. and Ford Global Technologies, Inc.



pVar = obj.Variables(isvalid(obj.Variables));
pInp = obj.Inputs;
objInp = infoarray(pInp);
VarTypes = obj.VariableTypes;

names = cell(size(pInp));
types = zeros(size(names));
values = cell(size(names));
for n = 1:length(pInp)
    ptr = pInp(n);
    names{n} = getname(objInp{n});
    if VarTypes(n)==0
        types(n) = 4;
        % Look for link against variables then other inputs we've processed
        [free, pLink] = cgisindependentvars(ptr, [pVar, pInp(1:n-1)]);
        if ~free
            values{n} = pLink.getname;
        else
            % Unable to find link that our status indicates exists
            values{n} = '<Unknown>';
        end
        
    elseif VarTypes(n)==1
        % Scalar
        types(n) = 1;
        values{n} = getstorevalue(objInp{n}, obj.StoreGUID, 1);
        
    elseif VarTypes(n)==2
        % Vector
        % Get a store value to work out whether to use a range or set
        % vector
        VectorType = getstorevalue(objInp{n}, obj.StoreGUID, 0);
        if VectorType==2
            % Stored range
            types(n) = 2;
            values{n} = getstorevalue(objInp{n}, obj.StoreGUID, 2);
        elseif VectorType==3
            % Stored vector
            types(n) = 3;
            values{n} = getstorevalue(objInp{n}, obj.StoreGUID, 3);
        end
    end
end
obj.hTable.setVariables(names, types, values);