Packs general matrix or array into a PV instance with a mask, name, and index.


p1 = pvPackmi(p1, x, nm, mask, i)
  • p1 (struct) – an instance of structure of type PV
  • x (MxN matrix or N-dimensional array) – data
  • nm (string) – matrix or array name.
  • mask (MxN matrix or N-dimensional array) – mask of zeros and ones.
  • i (scalar) – index of matrix or array in lookup table.

p1 (struct) – instance of PV struct.


// Declare PV structure
struct PV p1;
p1 = pvCreate;

// X matrix to be packed
x = { 1 2,
      3 4 };

// Mask
mask = { 1 0,
         0 1 };

// Pack x into "X" in PV struct
p1 = pvPackmi(p1, x, "X", mask, 1);

print pvUnpack(p1, 1);
1.000 2.000
3.000 4.000
p1 = pvPutParVector(p1, 5|6);
print pvUnpack(p1, 1);
5.000 2.000
3.000 6.000


The mask allows storing a selected portion of a matrix into the parameter vector. The ones in the mask matrix indicate an element to be stored in the parameter matrix. When the matrix is unpacked (using pvUnpackm()) the elements corresponding to the zeros are restored. Elements corresponding to the ones come from the parameter vector.

If the mask is all zeros, the matrix or array is packed with the specified elements in the second argument but no elements of the matrix or array are entered into the parameter vector. When unpacked the matrix or array in the second argument is returned without modification.

See also

Functions pvPackm(), pvUnpack()