%efficiencyBEWrapper loads data from the labview module
function [tDat,pres,cylPos,belPos,cur,motV,iq] = efficiencyBEwrapper(fName)

%If no inputted filename then ask for one
    if nargin == 0
        fName = input('Enter filename: ','s');
    end

    if strcmp(fName,'1')
        fName = 'Y:\Data\TestTankCPF2013Aug08T093642.xls';
    end
    
    %Try to open file. If invaild ask for new filename
    cont = 1;
    while cont == 1
        try
            fid = fopen (fName);
            %open data
            clin = fgetl(fid);
            cont = 0;
        catch
            disp('Invalid Filename')
            fName = input('Enter filename: ','s');
        end
    end
    
   cnt = 1;
   while(feof(fid)==0)
       clin = fgetl(fid);
       cDat = regexp(clin,'\t','split');
       pres(cnt) = str2double(cDat(3));
       cylPos(cnt) = str2double(cDat(4));
       belPos(cnt) = str2double(cDat(5));
       cur(cnt) = str2double(cDat(6));
       motV(cnt) = str2double(cDat(7));
       iq(cnt) = str2double(cDat(8));
       tstr = strtrim(cDat{2});
       tDat(cnt) = str2double(tstr(1:2))*3600+str2double(tstr(4:5))*60+str2double(tstr(7:end));
       cnt = cnt+1;
   end
   tDat = tDat-tDat(1);
   fclose(fid);
    
    
    