clc
clear
flist = dir('results_raw//*.mat');

for i = 1:length(flist)
    load(['results_raw//' flist(i).name]);
    r = results{1,1};
    
    if (strcmp(r.type,'rect'))
        r.res = max(r.res,0);
        r.res = min(r.res,1000);
    end
    
    r.type
    clear results
    results{1,1} = r;
    save (['results//' flist(i).name] , 'results');
end