Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MATLAB bindings #36

Open
FFroehlich opened this issue Jan 9, 2017 · 3 comments
Open

MATLAB bindings #36

FFroehlich opened this issue Jan 9, 2017 · 3 comments
Assignees

Comments

@FFroehlich
Copy link

I would like to request MATLAB bindings for this library! I would be happy to do any testing if necessary.

@fbergmann fbergmann self-assigned this Jan 9, 2017
@fbergmann
Copy link
Owner

hello Fabian,

unfortunately the matlab bindings will have to wait for a little while longer. SWIG ha no support for matlab bindings at this point, so we would have to write our own generator for it. We are in the process of doing that, but I am unsure when a release will be publicly available, i would not expect it to be before Q3 2017. I'll keep this thread posted when there is any change.

In the meantime you could still use the java bindings directly from matlab and call them.

best
Frank

@FFroehlich
Copy link
Author

hi Frank,

on the swig git is sounds like the matlab module is coming relatively soon (apparently only the documentation is missing jaeandersson/swig#9).

Using the java bindings in the meantime sounds like an excellent idea!

Best,
Fabian

@FFroehlich
Copy link
Author

As I found it quite challenging to get the matlab bindings running I thought it might be helpful to have the following guide (for OS X) for other people who want to try:

install compile sedml from https://github.com/fbergmann/libSEDML

important files:
libsedmlj.jnilib: default location is /usr/local/lib
libsedmlj.jar: default location is /usr/local/share/java

create a java loader class

To correctly load the native libraries in matlab we need to create a wrapper class. For this create a file loadsedml.java with the following contents:

public class loadsedml {
    static {
        java.lang.System.loadLibrary("sedmlj");
    }
}

compile this as loadsedml.class file by calling javac -target 1.5 -source 1.5 loadsedml.java

For me trying to load the java native library using java.lang.System.loadLibrary or java.lang.System.load directly from matlab did not work. Explicitely configuring target and source java version ensures that the class is loadable in the matlab JRE which can easily be older than the system JRE.

configure matlab java paths

java class path

edit $matlabroot/classpath.txt and add the absolute paths to libsedmlj.jar (e.g. /usr/local/share/java/libsedmlj.jar) and the compiled loadsedml.class

java library path

edit $matlabroot/classpath.txt and add the folder that contains libsedmlj.jnilib (e.g. /usr/local/lib)

in order for the changes to take effect you need to restart matlab now

load sedmlj.jnilib in matlab

call loadsedml;

after that the class org.sedml.libsedml.libsedml should be available

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants