
fid1 = fopen('maxdepth.dat','wt')

for ii = 1:156
    ii
    if (ii < 10)
        eval(['fid2 = fopen(''cast000' num2str(ii) '.eng'');'])
    elseif (ii < 100)
        eval(['fid2 = fopen(''cast00' num2str(ii) '.eng'');'])
    else
        eval(['fid2 = fopen(''cast0' num2str(ii) '.eng'');'])
    end
    
    while ~feof(fid2)
        line = fgetl(fid2);
        if strcmp(line,'Selecting free Mode')
            for jj = 1:8
                line = fgetl(fid2);
            end
            fprintf(fid1,'%d\n',str2num(line));
        end
    end
    fclose(fid2)
end

fclose(fid1)
