Code covered by the BSD License  

Highlights from
Avantes to Matlab

image thumbnail

Avantes to Matlab

by

 

11 Jun 2012 (Updated )

Read spectral data from Avantes USB2 spectrometer files

savelogfile
function savelogfile
% Saves global logString to a file with the current timestamp as the name.
% This is my experimental attempt to implement logging.
%
% Copyright (cc-by) K. Karapetyan, kotya.karapetyan@gmail.com, 2011.

global logString

timestamp = datestr(now, 'yymmdd_HHMMSS');

if ~isempty(logString)
    logFileName = ['log_' timestamp '.txt'];
    f = fopen(logFileName, 'w');
    fprintf(f, '%s', logString);
    fprintf('Log saved to %s\n', logFileName);
end

clear global logString

Contact us