www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@xregtools/@modeltransfertable/setListData.m
function obj = setListData(obj, models,names,icons) %SETLISTDATA Update table with new data. % % OBJ = SETLISTDATA(OBJ, ITEMS, NAMES, ICONS) % Copyright 2005-2011 The MathWorks, Inc. if isa(models,'xregpointer') models = pveceval(models,@getBestExportModel); elseif ~iscell(models) models = {models}; end obj.Items = models; obj.Names = names; % initialise replacemodels = cell(size(models)); transferactions = zeros(size(models)); replacenames = cell(size(models)); % get the current modexprs from the project pModExprs = obj.CageProject.getmodels; % for each modeldev find the modexpr that it could replace the model in. for i=1:length(obj.Items) pReplaceModels = pfilter( pModExprs, @canModelBeReplacedBy, models(i) ); replacemodels{i} = pveceval( pReplaceModels, @getname ); exactmatch = strcmp( replacemodels{i}, obj.Names{i} ); if isempty( replacemodels{i} ) || ~any( exactmatch ) %create new transferactions(i) = 0; replacenames{i} = obj.Names(i); else %replace transferactions(i) = 1; replacenames{i} = replacemodels{i}(exactmatch); end end obj.TransferAction = transferactions; obj.ReplaceNames = replacenames; % names - cell array of string % iconfiles - cell array of strings % transferaction - logical array % replacemodels - cell array of cell arrays of strings % replacenames - cell array of cell arrays of strings obj.Peer.setData( obj.Names, icons, obj.TransferAction, replacemodels, obj.ReplaceNames );