Packs general matrix into a structure of type PV with a mask and matrix name.


p1 = pvPackm(p1, x, nm, mask)
  • p1 (struct) – an instance of structure of type PV

  • x (MxN matrix or N-dimensional array) – data

  • nm (string) – name of matrix/array or N-dimensional array.

  • mask (MxN matrix) – mask matrix of zeros and ones.


p1 (struct) – instance of PV struct.


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

x = { 1 2,
      3 4 };

mask = { 1 0,
         0 1 };

p1 = pvPackm(p1, x, "X", mask);

print pvUnpack(p1, "X");
1.000 2.000
3.000 4.000
p1 = pvPutParVector(p1, 5|6);

print pvUnpack(p1, "X");
5.000 2.000
3.000 6.000


The mask argument allows storing a selected portion of a matrix into the packed vector. The ones in mask indicate an element to be stored in the packed matrix. When the matrix is unpacked (using pvUnpack()) the elements corresponding to the zeros are restored. Elements corresponding to the ones come from the packed vector which may have been changed.

If 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.