fid = fopen('constants.c','r');
InputText=textscan(fid,'%s','HeaderLines',4,'delimiter',';');

for k=1:size(InputText{1},1)
    temp = strsplit(InputText{1}{k});
    switch temp{2}
        case 'cHighSpeed'
            cHighSpeed = str2double(temp{4});
        case 'cLowSpeed'
            cLowSpeed = str2double(temp{4});
        case 'cNormalSpeed'
            cNormalSpeed = str2double(temp{4});
        case 'cExtraSpeed'
            cExtraSpeed = str2double(temp{4});
        case 'cMap'
            cMap = str2double(temp{4});
        case 'cAngle'
            cAngle = str2double(temp{4});
%         case 'cSlalomTiming[9]'
%             cSlalomTiming = [str2double(temp{4});
%                              str2double(temp{6});
%                              str2double(temp{8});
%                              str2double(temp{10});
%                              str2double(temp{12});
%                              str2double(temp{14});
%                              str2double(temp{16});
%                              str2double(temp{18});
%                              str2double(temp{20})]';
        case 'cSwapTiming[2]'
            cSwapTiming = [str2double(temp{4}); str2double(temp{6})]';
        case 'cZebraTiming'
            cZebraTiming = uint32(str2double(temp{4}));
        case 'cFinishTiming'
            cFinishTiming = uint32(str2double(temp{4}));
        case 'cBorderTiming[4]'
            cBorderTiming = [uint32(str2double(temp{4}));
                             uint32(str2double(temp{6}));
                             uint32(str2double(temp{8}));
                             uint32(str2double(temp{10}))]';
        case 'cLeft'
            cLeft = int16(str2double(temp{4}));
        case 'cRight'
            cRight = int16(str2double(temp{4}));
        case 'cGain'
            cGain = str2double(temp{4});
        case 'cDistanceRef'
            cDistanceRef = str2double(temp{4});
        case 'cTurnTable'
            cTurnTable = int16(str2double(temp{4}));
        case 'A_pd'
            A_pd = str2double(temp{4});
        case 'A_pid'
            A_pid = str2double(temp{4});
        case 'Ai'
            Ai = str2double(temp{4});
        case 'K[2]'
            K = [str2double(temp{4}); str2double(temp{6})]';
        case 'deg2cnt'
            deg2cnt = str2double(temp{4});
        case 'gain'
            gain = str2double(temp{4});
        case 'select'
            select = str2double(temp{4});
        otherwise
            disp('other value');
    end
end

fclose(fid); 
clear temp k InputText fid ans