www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@sweepset/struct2sweepset.m
function ss = struct2sweepset(oldss, in) %STRUCT2SWEEPSET Convert a structure to a sweepset % % STRUCT2SWEEPSET(SS, STRUCT) creates a new sweepset from the information % in the structure STRUCT. % % See also: SWEEPSET/SWEEPSET2STRUCT. % Copyright 2000-2010 The MathWorks, Inc. and Ford Global Technologies, Inc. % The input in is a structure generated from a call to sweepset2struct fields = fieldnames(in); % Use required fields to create the sweepset ss = sweepset('Variable', [], [], in.varNames, [], [], [], double(in.data)); % Check optional fields exist before using if ismember('varUnits', fields) && ~isempty(in.varUnits) set(ss, 'Units', in.varUnits(:)); end if ismember('varDescriptions', fields) && ~isempty(in.varDescriptions) set(ss, 'descript', in.varDescriptions(:)); end if ismember('comment', fields) ss.comment = in.comment; end if ismember('filename', fields) ss.number = in.filename; end