% Matlab program for displaying spectra % % Graphics initialization % Extract section from data file cd /tmp; !zcat {data_dir_long}/{file}.data.Z|{html_dir_long}/chuck {start}|{html_dir_long}/keep {length}>{temp_file}; % Load the file's contents load -ascii {temp_file}; % Determine how many channels [m n] = size({temp_file}); Tfile = abs(fft({temp_file}, 2^ceil(log2(m)))); % Force radix-2 [M N] = size(Tfile); f = [0:M/2]/M; if n == 1 % Single channel data {plot}(f, Tfile([0:M/2]+1), 'r'); set(gca, 'TickDir', 'out'); xlabel('Frequency'); ylabel('Spectral Amplitude'); title('Spectral plot of {data_dir_short}/{file}'); set(gcf, 'PaperType', 'a5'); orient tall; else for i=1:n subplot(n, 1, i); {plot}(f, Tfile([0:M/2]+1,i), 'r'); set(gca, 'TickDir', 'out'); if i == 1 title('Spectral plot of multichannel data {data_dir_short}/{file}'); end if i == n xlabel('Frequency'); else set(gca, 'XTickLabels', ' '); end ylabel(sprintf('Channel %d', i)); end set(gcf, 'PaperType', 'a5'); orient tall; end % Create output file print -dgif8 {gif_file}; % Clear figure & reset all its properties (except Position) clf reset % Delete temporary files !rm {temp_file}; !rm /softlib1/htdocs/spib/spib{temp_file}.m;