Friday, June 05, 2015

Netgen on a Mac called from MATLAB

One of the many irritations of MATLAB on a Mac is that calling a command from the system function runs the command in a shell with messed up environment variables. In EIDORS we call Netgen to create meshes.

There are several environment variables I needed to get this to work.
Of course I needed to set the Netgen path for example

 export NETGENDIR=$HOME/netgen/bin 

The equivalent of Linux's LD_LIBRARY_PATH is needed for the Togl library export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$HOME/lib/Togl1.7 

Then it still can't find Tik so you need to set

 TCLLIBPATH=$HOME/lib 

You can put that all in s string separated with semi colons and then the netgen command eg

$NETGENDIR/netgen 

and it works.