ParametersRun500

dataset_positions = [{2,0}; {2,1}; {2,2}; {2,3}; {2,5}; {4,0}; {4,1}; {4,2}; {4,3}; {4,4}; {4,5}; {5,0}; {5,1}; {5,2}; {5,3}; {6,0}; {6,1}; {6,2}; {6,3}; {6,4}; {6,5}; {7,0}; {7,1}; {7,2}; {7,3}; {7,4}; {7,5}; {10,0}; {10,1}; {10,2}; {10,3}; {10,4}; {10,5}];

num_embryos = size(dataset_positions,1);

for i = 1:num_embryos
    
    dataset = dataset_positions{i,1};
    position = dataset_positions{i,2};
%     first_stack = calculated_stacks{dataset,position+1}(1);
    last_stacks(i) = stacks{dataset,position+1}(2);
    offsets(i)= time_offsets{dataset,position+1};
end

zero_point = ones(1,num_embryos)*89;

last_gaps = last_stacks - zero_point;

last_gaps_corrected = last_gaps + offsets;