www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@sweepset/vertcat.m
function C = vertcat(A,varargin) %VERTCAT Concatenate record(s) to sweepset % % [A;B] % Concatenates 2 sweepset objects (adds records together). An error is % returned if the sweepsets have a different number of variables It is % possible to add a double matrix to the end of a sweepset. In this case % a sweep with type -1 and test number -1 is assumed. % Copyright 2000-2014 The MathWorks, Inc. and Ford Global Technologies, Inc. C = A; % Check that the first argument of the call is a sweepset if ~isa(A, 'sweepset') error(message('mbc:sweepset:InvalidArgument23')); end for i = 1:length(varargin) B = varargin{i}; switch class(B) case 'sweepset' if size(C,2) == size(B,2) % Check that the variable names all match if isequal({C.var.name},{B.var.name}) % Concatenate the data C.data = [C.data ; B.data]; C.baddata = [C.baddata ; B.baddata]; C.guid = [C.guid ; B.guid]; C.xregdataset = [C.xregdataset; B.xregdataset]; % Update the variable min and max if size(B,1) > 0 for j = 1:numDataVariables(C) C.var(j).min = min([ C.var(j).min; B.var(j).min ]); C.var(j).max = max([ C.var(j).max; B.var(j).max ]); end end else error(message('mbc:sweepset:InvalidArgument24', i)); end else error(message('mbc:sweepset:InvalidArgument25', i)); end case 'double' % Check that the correct number of columns exist if size(C,2) == size(B,2) && ndims(B) == 2 % Concatenate the new data C.data = [C.data ; B]; C.baddata = [C.baddata ; sparse(size(B, 1), size(B, 2))]; C.guid = [C.guid ; guidarray(size(B, 1))]; C.xregdataset = [C.xregdataset; xregdataset(-1, -1, size(B,1))]; % Update the variable min and max if size(B, 1) > 0 mindat = min(B, [], 1); maxdat = max(B, [], 1); for j = 1:numDataVariables(C) C.var(j).min = min([ C.var(j).min; mindat(j) ]); C.var(j).max = max([ C.var(j).max; maxdat(j) ]); end end else error(message('mbc:sweepset:InvalidArgument26', i)); end otherwise error(message('mbc:sweepset:InvalidArgument27')); end end % All concatenated maps are workmaps C.workmap = 1;