The instructions for MATLAB depend on the operating system you are using.
The installation directory is also the same one where the additional
files TranslateSBML
.extension,
OutputSBML
.extension and CheckAndConvert.m
will have been placed. These files implement the MATLAB interface to
libSBML. On Linux and Unix-based systems including Mac OS X, the
LD_LIBRARY_PATH
/DYLD_LIBRARY_PATH
environment
variable may need to be set in the terminal shell from which MATLAB is
started prior to starting MATLAB. (Otherwise, MATLAB itself will not "see"
the value of the variable.)
Important: some versions of MATLAB produced for Linux include a version of the stdc++ library that conflicts with the version provided by the operating system, causing a mystifying error when MATLAB tries to run or compile code involving libSBML. Please see the section in the Known Issues document for more information.
An additional step is necessary in the MATLAB environment itself:
adding the same directory to the list of directories that MATLAB searches
to find functions. If DIR is the
directory where the libSBML shared library as well as
TranslateSBML
.extension,
OutputSBML
.extension, and
CheckAndConvert.m
have been installed, then the following
MATLAB command must be executed:
addpath('DIR');
For example, suppose you are using an Intel-based Mac OS X system
and you have configured libSBML to install itself into
/usr/local
. Then the files
TranslateSBML.mexmaci
, OutputSBML.mexmaci
and CheckAndConvert.m
will have been installed as
/usr/local/lib/TranslateSBML.mexmaci
,
/usr/local/lib/OutpuSBML.mexmaci
and
/usr/local/lib/CheckAndConvert.m
. You will need to set
your DYLD_LIBRARY_PATH
environment variable to
/usr/local/lib
, and also execute the following command
(or an equivalent) in MATLAB:
addpath('/usr/local/lib');
To save the trouble of having to type the command above each
time you start MATLAB, you may wish to put it in your
startup.m
file (i.e., the file MATLAB uses for user
initialization). Please refer to the MATLAB documentation for more
information about startup.m
and where it is located.
Most Windows users will probably prefer to install libSBML using the
self-extracting installer provided separately and available for downloading
from the same servers as the libSBML source code distribution. The
installer will take care of placing the MATLAB files in directories where
MATLAB can find them. Nothing further needs to be done in that case. You
should be able to start MATLAB at will, and be able to invoke functions
like TranslateSBML
and OutputSBML
.
If you are compiling and installing libSBML from the sources, or else want/need to install the MATLAB bindings directly from the libSBML source distribution on Windows, follow these simple steps:
libsbml/src/bindings/matlab
, where
libsbml
is the root of your
libSBML source directory on your computer.
buildSBML
in MATLAB.
installSBML
in MATLAB.
After these steps, you should be able to invoke functions such as
TranslateSBML
and OutputSBML
. These will be
accessible after you restart MATLAB and even when you are no longer in the
libSBML directory.