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

    function syncValues(obj)
%SYNCVALUES Sets all inputs to the values specified in the table.
%
%  SYNCVALUES(OBJ) sets the current list of CAGE inputs to have the values
%  that are currently stored as being the table display.

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


pInp = obj.Inputs(obj.VariableTypes>0);
VarTypes = obj.VariableTypes(obj.VariableTypes>0);

objInp = infoarray(pInp);
for n = 1:length(pInp)
    if VarTypes(n)==1
        % Scalar
        objInp{n} = copystoretovalue(objInp{n}, obj.StoreGUID, 1, 'nominalvalue');
    elseif VarTypes(n)==2
        % When this input was chosen to be a vector it should have been
        % initialised with required data
        VectorType = getstorevalue(objInp{n}, obj.StoreGUID, 0);
        if VectorType==2
            rangeinfo = getstorevalue(objInp{n}, obj.StoreGUID, 2);
            objInp{n} = setvalue(objInp{n}, linspace(rangeinfo(1), rangeinfo(2), rangeinfo(3)));
        else
            objInp{n} = copystoretovalue(objInp{n}, obj.StoreGUID, 3, 'nominalvalue');
        end
    end
end
passign(pInp, objInp);