UNPACK— Unpack an array of rank one into an array
RESULT = UNPACK(VECTOR, MASK, FIELD)
|VECTOR||Shall be an array of any type and rank one. It
shall have at least as many elements as MASK has |
|MASK||Shall be an array of type |
|FIELD||Shall be of the sam type as VECTOR and have
the same shape as MASK.
TRUEelements of MASK replaced by values from VECTOR in array element order.
PROGRAM test_unpack integer :: vector(2) = (/1,1/) logical :: mask(4) = (/ .TRUE., .FALSE., .FALSE., .TRUE. /) integer :: field(2,2) = 0, unity(2,2) ! result: unity matrix unity = unpack(vector, reshape(mask, (/2,2/)), field) END PROGRAM