www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgoppoint/convertGridToBlock.m
function obj = convertGridToBlock(obj) %CONVERTGRIDTOBLOCK Convert gridded factors into data blocks % % OBJ = CONVERTGRIDTOBLOCK(OBJ) checks for the existence of any gridded % inputs and convertes them into blocks of data. % Copyright 2000-2009 The MathWorks, Inc. and Ford Global Technologies, Inc. isGrid = (obj.factor_type==1) & (obj.grid_flag==1); if any(isGrid) % Convert these factors to be just chunks of data obj.grid_flag(isGrid) = 7; obj.range(isGrid) = {[]}; % Record an original name so we can unassign this data block from its % original variable (i.e. treat as if imported data) myname = get(obj, 'factors'); ToChange = isGrid & cellfun('isempty',obj.orig_name); obj = set(obj, find(ToChange), 'orig_name', myname(ToChange)); obj = set(obj, find(isGrid), 'created_flag', zeros(1,sum(isGrid))); end % Always fix the block length if there are any blocks if any(obj.grid_flag==7) % Set the blocklen to be the size of the dataset obj.blocklen = size(obj.data, 1); end