cpf_detect_events

cpf_detect_events(cpf_events, cef, pef, step, verbose)

cpf_detect_events() - Detect events from event function values.

[ROLLBACK, CRITICAL_EVENTS, CEF] = CPF_DETECT_EVENTS(CPF_EVENTS, CEF, PEF, STEP, VERBOSE)

Inputs:
    CPF_EVENTS : struct containing info about registered CPF event fcns
    CEF : cell array of Current Event Function values
    PEF : cell array of Previous Event Function values
    STEP : current step size
    VERBOSE : 0 = no output, otherwise level of verbose output

Outputs:
    ROLLBACK : flag indicating whether any event has requested a
        rollback step
    CRITICAL_EVENTS : struct array containing information about any
        detected events, with fields:
        eidx        : event index, in list of registered events
                        0 if no event detected
        name        : name of event function, empty if none detected
        zero        : 1 if zero has been detected, 0 otherwise
                        (interval detected or no event detected)
        idx         : index(es) of critical elements in event function
        step_scale  : linearly interpolated estimate of scaling factor
                      for current step size required to reach event zero
        log         : 1 log the event in the results, 0 don't log the event
                      (set to 1 for zero events, 0 otherwise, can be
                        modified by callbacks)
        msg         : event message, set to something generic like
                        'ZERO detected for TARGET_LAM event' or
                        'INTERVAL detected for QLIM(3) event', but intended
                      to be changed/updated by callbacks
    CEF : cell array of Current Event Function values