function [cell, maxt_list]=RearrangeTime(cell)

[max_id, max_time,n]=size(cell);

tmp_cell=zeros(max_id,max_time,n);

for id=1:max_id
    t_array=cell(id,:,1);
    t_list=find(t_array>0);
    
    if ~isempty(t_list) % This is for the data #7
        min_t=min(t_list);
        t_list2=t_list-min_t+1;
        tmp_cell(id,t_list2,1:3)=cell(id,t_list,1:3);
        maxt_list(id,1)=max(t_list2);  % duration period
    end
end

cell=tmp_cell;

end