function [FluxOut,Time,Wvls,Header] = ReadFlxTab(FlxPath)

fidFlx = fopen(FlxPath,'r');
disp(['File Open: ',FlxPath]);
for iHeader = 1:6
    Header(iHeader).line = fgetl(fidFlx);
end

[token,discard] = strtok(Header(3).line);
nWvls = str2num(token);

WvlLine = Header(6).line;
Wvls = zeros(nWvls,1);
for iWvl = 1:nWvls
    [token,WvlLine] = strtok(WvlLine);
    Wvls(iWvl) =str2num(token);
end

FormatString = '';
%build textscan format string
for iVar = 1:nWvls+3
    FormatString = [FormatString,'%f'];
end

FlxData = textscan(fidFlx,FormatString);
fclose(fidFlx);

nLines = length(FlxData{1});

Time.FracDOYsCPU = FlxData{1};
Time.FracDOYsIRIG = FlxData{2};
Time.SAM = FlxData{3};

for iVar = 1:nWvls
    tempData = FlxData{iVar+3};
    for iLine = 1:nLines
        FluxOut(iLine,iVar) = tempData(iLine);
    end
end


disp(['File Read: ',FlxPath]);

