function [kearfottData] = readKearfott(file)

    %first initialize output data structure
    fd = fopen(file);
    navMsgCnt = 1;

    while (~feof(fd))
        %search for header value;
        while (fread(fd,1,'uchar') ~= 170) end;
        msgID = fread(fd,1,'uchar');
        switch (msgID)
            case 1
               kearfottData(navMsgCnt).navMsg = readNavigationMsg(fd);
               navMsgCnt = navMsgCnt+1;                    
            end
    end

    fclose(fd);

function navMsg = readNavigationMsg(fd)
    byteCnt = fread(fd,1,'uchar');
    if (byteCnt ~= 46)
        navMsg.cycles = 0;
        navMsg.cycles = 0;
        navMsg.mode = 0;
        navMsg.monitor = 0;
        navMsg.lat = 0;
        navMsg.lon = 0;
        navMsg.depth = 0;
        navMsg.alt = 0;
        navMsg.roll = 0;

navMsg.pitch = 0;

navMsg.heading = 0;

navMsg.vx =  0;

navMsg.vy =  0;

navMsg.vz =  0;

navMsg.ax =  0;

navMsg.ay =  0;

navMsg.az =  0;

navMsg.prate =  0;

navMsg.qrate =  0;

navMsg.rrate =  0;

navMsg.utcTime =  0;

        return;
        end;
    navMsg.cycles = fread(fd,1,'ushort');
    navMsg.mode = fread(fd,1,'uchar');
    navMsg.monitor = fread(fd,1,'uchar');
    navMsg.lat = fread(fd,1,'int32') * pi/2^31;
    navMsg.lon = fread(fd,1,'int32') * pi/2^31;
    navMsg.depth = fread(fd,1,'int32') * 0.1;
    navMsg.alt = fread(fd,1,'ushort') * 0.01;
    navMsg.roll = fread(fd,1,'short') * pi/2^15;
    navMsg.pitch = fread(fd,1,'short') * pi/2^15;
    navMsg.heading = fread(fd,1,'ushort') * pi/2^15;
    navMsg.vx = fread(fd,1,'short') * 2^-10;
    navMsg.vy = fread(fd,1,'short') * 2^-10;
    navMsg.vz = fread(fd,1,'short') * 2^-10;
    navMsg.ax = fread(fd,1,'short') * 2^-10;
    navMsg.ay = fread(fd,1,'short') * 2^-10;
    navMsg.az = fread(fd,1,'short') * 2^-10;
    navMsg.prate = fread(fd,1,'short') * 2^-13;
    navMsg.qrate = fread(fd,1,'short') * 2^-13;
    navMsg.rrate = fread(fd,1,'short') * 2^-13;
    navMsg.utcTime = fread(fd,1,'uint32') * 2^-14;


