Added logical indexing to subarrays. Fix #4763