function varargout = setsvals(varargin) % SETSVALS % sets the SVAL records for the SUS debug = 0; if nargin < 2 error('Needs 2 arguments.') elseif nargin > 2 error('Too many agrs') elseif nargin == 2 good_time = varargin{1}; duration = varargin{2}; end %%%%%% Create the channel list ----------------------- ifo = 'C1'; head = [ifo ':SUS-']; % List of all the optics optics = {'MC1','MC2','MC3','PRM','SRM','BS',... 'ITMX','ITMY','ETMX','ETMY'}; if debug == 1 optics = {'MC1'}; end % List of all DOFs (i.e. SUSPIT, etc.) dogs = {'POS','PIT','YAW'}; chans = []; for kk = 1:length(optics) for mm = 1:length(dogs) newchan = strcat(head, optics(kk), '_SUS',... dogs(mm), '_INMON'); chans = [chans;newchan]; end end %%%%%% ----------------------------------------------- % Run get_trend to get the trend data out = get_trend(chans,'minute',good_time,duration); for kk = 1:length(optics) for mm = 1:length(dogs) idx = (kk-1)*3 + mm; % Takes the mean over the duration new_sval = mean(out(idx).mean); % Uses tdswrite to write out the values [a,b] = system(['tdswrite ' chans{idx} ... '.SVAL ' num2str(new_sval)]); end end