saveOSAtrace

by

 

Svaes traces ['A', 'BC' etc] from OSA at specified GPIB address

saveOSAtrace.m
function saveOSAtrace(adr1,trace,name,plotit)
% svaves traces ['A' or 'AC' etc] from OSA at specified GPIB
% cc Mikael Malmstrm
% Version 2013-02-15

for ii=1:length(trace)
    Data=getOSAtrace(adr1,trace(ii));
    try 
        % Get resolution BandWidth and put in name
        BW=['BW' num2str(str2num(GPIBq(adr1,'BAND?'))*1e9) 'nm_'];
    catch
        BW='';
    end
    try
        % Get Average and put in name
        AVG=['AVG' num2str(str2num(GPIBq(adr1,'CALC:AVER:COUN?'))) '_' ];
    catch
        AVG='';
    end
    
    filename=['OSA_' name '_' BW AVG trace(ii) '.csv'];
    % Write file
    dlmwrite(filename,Data,'precision','%1.6e'); 
    %Plot results if wanted
    if nargin==4
        h=figure(ii);
        plotOSA(filename,h)
    end
end

    

Contact us