%loadflux % Read the data from VOCALS_2008 flux file function [bao300 dt n] = load300( filename, nmax ) dt = zeros(nmax,7); bao300 = zeros( nmax, 14); %fprintf(1,' Reading %s\n', filename ); f300 = fopen(filename,'r'); n = 0; while ~feof(f300) %read in 4 header lines temp=fgetl(f300); if( temp(2) == '2') n = n + 1; dt(n,1:6) = sscanf(temp,'"%4d-%2d-%2d %2d:%2d:%2d'); % start reading the data line after the date/time string % convert each , to a blank space then read [data]=sscanf(strrep( temp(23:length(temp)), ',', ' ' ),'%f') ; bao300(n,1:14) = data(2:15); end end %while ~feof(f300) dt(:,7) = datenum(dt(:,1),dt(:,2),dt(:,3),dt(:,4),dt(:,5),dt(:,6))-datenum(dt(:,1)-1,12,31); %bao300(1:n,15) = dt(1:n,7); % Year Day fclose(f300);