fabien van mook

all packages "fvm-*"

package "fvm-htab"

function file "nustruct.m"

Function nu = nustruct(cnu)

converts special cell array cnu into a special
struct (or an array of special struct's) nu.
Both special objects combine number and unit data.

The cell array cnu contains numbers (possibly in
a string representation) on the uneven rows, and
units (as strings) on the even rows. If it has more
than one columns, an respective array of special 
struct's is returned:

  nustruct({n1;u1}) ==> nu1
  nustruct({n1,n2,...;u1,u2,...}) ==> {nu1,nu2,...}

where each special struct has the form 
  nuK.(uK) = nK.

Each unit string in the input will form a field 
name in the special struct; and the value of the
field is the sum (as a real number) of all values
associated with the same unit.

Non-finite numbers, numbers which have been wrongly 
written as strings, and empty unit strings will
be ignored: as if nothing was given. Then,  a
warning message will be given.


(c) 2026 fabien van mook

2026.08.20 release of this file within package "fvm-htab" under GNU GPLv3+