General Toolkit - packfields


Loadable Function: packfields (s_name, var1, var2, …)

Create struct from variables.

Inserts the named variables var1, var2, … as fields into the struct named s_name. If it does not exist, a struct with that name is created.

This is equivalent to the code:

  s_name.var1 = var1;
  s_name.var2 = var2;
          :          

but more efficient and more concise.

See also: setfield, setfields, struct, unpackfields.