fid=fopen(strcat(path,'pacemaker_mdp.lab'),'r');

% Read the first line of the file
% state 0="init" 1="deadlock" 2="invariants"
% Read the first dummy line
tline=fgetl(fid);
state_string='';
init_found=0;
while ischar(tline)
    state_string='';
    tline = fgets(fid);
    for i=1:size(tline,2),
        if tline(i)~=':',
            state_string=strcat(state_string,tline(i));
        elseif tline(i+2)=='0',
                init_found=1;
        else
            break;
        end
    end
    if init_found==1,
        break;
    end
    %disp(state_string);
end

c_state_PACEMAKER=str2num(state_string);

fclose(fid);