UNPACK

Platform

x64, Win32, .NET

Purpose

Unpack a one-dimensional array under the control of a mask.

Class

Transformational function.

Syntax

FUNCTION UNPACK(VECTOR, MASK, FIELD)
LOGICAL MASK

Description

VECTOR is a one-dimensional array of any type. Its size is at least t where t is the number of true elements in MASK. MASK is a logical array. FIELD has the same type and type parameters as VECTOR and is conformable with MASK.

The result is an array with the same type and type parameters as VECTOR and the same shape as MASK.

Return value

Elements of VECTOR are unpacked into the result at positions where MASK is true. Unpacking starts along the first dimension (index) of MASK. When an element of MASK is false, FIELD is used if it is a scalar otherwise the corresponding element of FIELD is used.

Example

If VECTOR = [2, 3, 4, 5, 6], MASK = and FIELD = , then the result is .

 

 

Basket
Empty
 
Copyright © 1999-2024 Silverfrost Limited