function [name,msg] = fullexp(pulse,scan,comment,type,antenna,exact) %[NAME,MSG] = FULLEXP(PULSE,SCAN,COMMENT,TYPE,ANTENNA,EXACT) % % Construct an EISCAT experiment name string, in the format % specified by the document % % TvE: Experiment Name Conventions Proposal to SAC 16/06/01 % % given the various component strings. % % If all the compoments are valid, and the resulting string % is not too long, NAME contains the result string and MSG % is empty. Otherwise MSG contains an error message and NAME % is ill-defined. % % If the EXACT flag is set, the given components are % used exactly is given. If it is not set, or is not given, % the correct character case for SCAN, COMMENT, TYPE and ANTENNA % is enforced automatically. % % See also expparts.m % % Example % % fullexp('pulse','scan','my_comment','ei','32m') % ==> 'pulse_scan_My_comment_EI@32m' % % 19-Jun-2001 Jm %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% msg = ''; name = ''; if nargin < 5 | nargin > 6 error('wrong number of input arguments') end if nargin == 5 exact = 0; end % (1) PULSE must not be empty, and must not contain '@' or '_' if isempty(pulse) msg = 'PULSE must not be empty'; return; end if ~isregular(pulse,'@_') msg = 'PULSE contains illegal characters'; return; end % (2) SCAN must not contain '@' or '_', and must start with lower case if ~isempty(scan) if ~isregular(scan,'@_') msg = 'SCAN contains illegal characters'; return; end if ~exact scan(1) = lower(scan(1)); end if scan(1) < 'a' | scan(1) > 'z' msg = 'SCAN must start with a lower case letter'; return; end scan = ['_' scan]; end % (3) COMMENT must not contain '@', and must start with upper case if ~isempty(comment) if ~isregular(comment,'@') msg = 'COMMENT contains illegal characters'; return; end if ~exact comment(1) = upper(comment(1)); end if comment(1) < 'A' | comment(1) > 'Z' msg = 'COMMENT must start with an upper case letter'; return; end comment = ['_' comment]; end % (4) TYPE if given, must be one of predefined strings if ~isempty(type) types = {'CP','FI','FR','GE','NO','NI','SW','UK','EI','3P','SP'}; if ~exact type = upper(type); end K = strmatch(type,types,'exact'); if length(K) ~= 1 msg = 'Illegal TYPE'; return; end type = ['_' type]; end % (4) ANTENNA must exist and must be one of predefined strings if isempty(antenna) msg = 'ANTENNA must be specified'; return; else antnames = {'uhf','kir','sod','vhf0','vhf1','vhf2','32m','42m'}; if ~exact antenna = lower(antenna); end K = strmatch(antenna,antnames,'exact'); if length(K) ~= 1 msg = 'Illegal ANTENNA'; return; end end antenna = ['@' antenna]; name = [pulse scan comment type antenna]; if length(name) > 32 msg = 'too long'; end return %end fullexp function ans = isregular(s,Illegal) %---------------------------------- if length(Illegal) == 2 K = find(s == Illegal(1) | s == Illegal(2)); else K = find(s == Illegal(1)); end ans = isempty(K); return %end isregular