www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgtradeoffnode/pFillTradeOff.m
function pFillTradeOff(obj,data,pInputs) %PFILLTRADEOFF fill tradeoff with data % % pFillTradeOff(obj,data,pInputs) % Copyright 2007 The MathWorks, Inc. and Ford Global Technologies, Inc. pAll = [pGetTableInputs(obj), pGetOtherInputs(obj)]; if ~isempty(pAll) DataColumnIndex = findptrs(pAll, pInputs); hAll = infoarray(pAll); [obj, datakeys] = i_getswitchpoints(obj); NPTS = size(data,1); for r = 1:NPTS % For each trade off cell selected for m = 1:length(hAll) % For each free/fixed variable if DataColumnIndex(m) > 0 thisdata = data(r,DataColumnIndex(m)); else % This trade off variable is not in the list of specified inputs. % Use the value from the trade off store, or the set % point if the store is empty. thisdata = getstorevalue(hAll{m}, obj.ObjectKey, ... datakeys(r)); if isempty(thisdata) thisdata = getnomvalue(hAll{m}); end end hAll{m} = setstorevalue(hAll{m}, obj.ObjectKey, ... datakeys(r), thisdata); end end passign(pAll, hAll); end % Mark each of these points as having been saved obj.DataKeyTable = incrementSaveCounter(obj.DataKeyTable, datakeys); % Apply filling action to all of these points that have a table link [TableIndex, HasLink] = getTableFromDatakey(obj.DataKeyTable, datakeys); pSetInputsAt(obj, datakeys(HasLink)); captureTableFillAt(obj, getTable(obj, 'all'), TableIndex{:}); xregpointer(obj); function [obj, datakeys] = i_getswitchpoints(obj) if numTables(obj)>0 pTableData = getAllTableData(obj); setInputsAt(obj, 'table', 1, 1); OK = pTableData(1,1).setinportsforcells; pInp = pGetTableInputs(obj); if OK msk = false(pTableData(1,1).getTableSize); for n = 1:size(pTableData,1) if ~isnull(pTableData(n,3)) && pTableData(n,3).isSwitchExpr msk = msk | pTableData(n,3).getSwitchGrid(pInp); end end [R, C] = find(msk); new = ~containsTable(obj.DataKeyTable, R, C); % Add data keys for new input settings obj.DataKeyTable = addTableDatakeys(obj.DataKeyTable, R(new), C(new)); % Get the datakeys for all cells required datakeys = getDatakeyFromTable(obj.DataKeyTable, R, C); else datakeys = []; end else datakeys = []; end