XMM-Newton SAS Home Page
XMM-Newton Science Analysis System


ssclib (ssclib-4.36.1) [xmmsas_20230412_1735-21.0.0]

Return smallest true index of a logical vector

  integer function smallestTrueIndex(maskVector)
    logical(bool), intent(in) :: maskVector(:)
  end function

Examples:

  smallestTrueIndex(((/0, 1, 1/) > 0)) ! returns 2
  smallestTrueIndex(((/1, 1, 1/) > 0)) ! returns 1
  smallestTrueIndex(((/0, 0, 0/) > 0)) ! returns 4, ie 1 above vector limit.

size(maskVector)+1 is also returned if the vector is of zero size.



XMM-Newton SOC -- 2023-04-16