www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgoptimtablefiller/private/pDirectFill.m
function [ok, newtabdata, fillmask] = pDirectFill(varargin) %PDIRECTFILL Fill table via direct copy % % [OK, NEWTABDATA, FILLMASK] = PDIRECTFILL(COL, ROW, FILLDATA, COLAXIS, % ROWAXIS, CURRTABDATA) creates a set of 2-d table values at the [ROW, % COL] points by copying them from those in the supplied FILLDATA. The % axes of the table to be filled are specified in the vectors, ROWAXIS and % COLAXIS. The current table data is specified in CURRTABDATA. If the fill % has been successful, OK = TRUE. The new table data is returned in % NEWTABDATA and those points that have been filled are denoted in the % logical FILLMASK. If no data is transferred to the table, then OK = % FALSE. % % [OK, NEWTABDATA, FILLMASK] = PDIRECTFILL(ROW, FILLDATA, ROWAXIS, % CURRTABDATA) creates a set of 1-d table values at the ROW points by % copying them from those in the supplied FILLDATA. If the fill has been % successful, OK = TRUE. The new table data is returned in NEWTABDATA and % those points that have been filled are denoted in the logical FILLMASK. % If no data is transferred to the table, then OK = FALSE. % % See also PEXTRAPOLATEFILL % Copyright 2005 The MathWorks, Inc. and Ford Global Technologies, Inc. % Initialise return arguments newtabdata = []; fillmask = []; % Get inputs from varargin in = varargin; [ok, filldata, axes, currtabdata, NDIM] = pExtractTableFillingInputs(in); if ~ok return end % Initialise return table newtabdata = currtabdata; % Find the cells at which the optimization was run at defcells = filldata(:, 1:NDIM); [ok, locind, indsin] = pFindCellsInTable(axes, defcells); % Copy data and create fill mask if ok && ~isempty(locind) newtabdata(locind) = filldata(indsin, NDIM + 1); fillmask = zeros(size(newtabdata)); fillmask(locind) = 1; else newtabdata = []; fillmask = []; ok = false; end