www.gusucode.com > mbcexpr 工具箱 matlab 源码程序 > mbcexpr/+cgsimfill/@EvalPoints/pSetInStore.m

    function pSetInStore(V, pVar, value, location)
%PSETINSTORE Set value into store
%
%   PSETINSTORE(V, PVAR, VALUE, LOCATION)
%
%   LOCATION can be either 'user' or 'default', the default location is
%   'user'.

%   Copyright 2006-2008 The MathWorks, Inc.

if length( pVar )>1
    error(message('mbc:cgsimfill:evalpoints:InvalidInput1'));
end

if nargin==3
    location = 'user';
end

if( containsvalue( V.ValueStore, pVar ) )    
    V.ValueStore = iUpdateStore( V.ValueStore, pVar, value, location );
elseif( containsvalue( V.LinkInputStore, pVar ) )    
    V.LinkInputStore = iUpdateStore( V.LinkInputStore, pVar, value, location );
else
    error(message('mbc:cgsimfill:evalpoints:InvalidInput2', pVar.getname));
end

function store = iUpdateStore( store, pVar, value, location )
currentValue = getvalue( store, pVar );
switch location
    case 'user'
        currentValue{2} = value;
    case 'default'
        currentValue{1} = value;
end
store = setvalue( store, pVar, currentValue );