Author Topic: Matlab: How to load an OOBN  (Read 14080 times)

Offline Anders L Madsen

  • HUGIN Expert
  • Hero Member
  • *****
  • Posts: 2295
    • View Profile
Matlab: How to load an OOBN
« on: July 13, 2011, 18:06:11 »
Using the HUGIN .NET API it is possible to make use of HUGIN functionality in Matlab. The appropriate HUGIN dll file should be loaded as an assembly into Matlab.

The following example illustrates how to load the StudFarm example from the Samples/oobn directory of the HUGIN installation and print the belief in node John.offspring:

Code: [Select]
ghapi = NET.addAssembly ('C:\Program Files\Hugin Expert\Hugin Researcher 7.4\HDE7.4CS\Lib\hugincs-7.4-2.0-x64.dll');
cc = HAPI.ClassCollection();
cc.ParseClasses ('C:\Program Files\Hugin Expert\Hugin Researcher 7.4\Samples\oobn\StudFarm.net', HAPI.DefaultClassParseListener);
c = cc.GetClassByName ('StudFarm');
d = c.CreateDomain ();
d.Compile ();
d.GetNodeByName ('John.offspring').GetBelief (0)
ans =

    0.2734

Notice that all classes of the example are stored as a class collection in a single file.
HUGIN EXPERT A/S