% [depth_yoyo, time_yoyo, number_yoyo, whichway_yoyo] = yoyo_classifier( depth.value, depth.time );

for i = 1:max(number_yoyo)-1
    test1 = find(number_yoyo == i);
    test2 = find(number_yoyo == i+1);
    
    if whichway_yoyo(test1(1)) > 0
        t1 = time_yoyo(test1(length(test1)));
        t2 = time_yoyo(test2(1));
        dt = t2-t1;
        
        % Only generate plots if downcast and upcast close...
        if dt < 1/(24*60)
            i_min = find((depth.time >= t1) & (depth.time <= t2));
            i_min_s = find(depth.value(i_min) == max(depth.value(i_min)));
            time_min = depth.time(i_min(1));
            
            % time_min = 0.1740;
            ok = find(depth.time > time_min-0.0003 & depth.time < time_min+0.0003);
            tt = depth.time(ok) - depth.time(ok(1));
            
            hold off
            
            xvel_d =  interp1(platform_x_velocity_wrt_ground.time,  platform_x_velocity_wrt_ground.value, depth.time);
            pmp_d = interp1(platform_mass_position.time, platform_mass_position.value, depth.time);
            pitch_d = interp1(AHRS_sp3003D.platform_pitch_angle.time,  AHRS_sp3003D.platform_pitch_angle.value, depth.time);
            alt_d = interp1(DVL_micro.height_above_sea_floor.time,  DVL_micro.height_above_sea_floor.value, depth.time);
            
            plot(tt*24*60*60, xvel_d(ok), 'r.');
            hold on;
            plot(tt*24*60*60, alt_d(ok), 'ro');
            plot(tt*24*60*60, pitch_d(ok)/10, 'k.');
            plot(tt*24*60*60, depth.value(i_min(1)) - depth.value(ok), 'ko');
            plot(tt*24*60*60, pmp_d(ok), 'go');
            hold off;
        end;
    end;
end;