Modifying the MATLAB » History » Version 4

Version 3 (Chris Cannam, 2014-03-12 02:06 PM) → Version 4/12 (Chris Cannam, 2014-03-12 02:10 PM)

h1. Modifying the MATLAB

h2. Context

You want to change something in the MATLAB code and deploy the changed version.

h2. You will need

* A computer with a licensed copy of MATLAB. This step uses the "mcc" compiler included in the MATLAB distribution.
* The Java development kit (JDK) of whichever version your MATLAB installation expects. Current MATLAB seems to call for Java 7.

You do _not_ need the separate MATLAB compiler runtime package at this stage.

h2. What to change; limitations

The webapp repository includes the MATLAB code as a sub-repository, in a directory called @mcode@. Any MATLAB code in this directory can be called from the web app. The calling convention uses a MATLAB struct to pass the arguments, as you can see in the existing examples.

File access is a thorny subject; compiled MATLAB is usually run in its own environment in which the current working directory is unpredictable. It's safest to assume that the current working directory is unavailable or unknown, and to pass in a working or scratch directory as one of the MATLAB function arguments and then use paths relative to that.

h2. How to rebuild

In the main directory of the web app project (i.e. above the @mcode@ directory), either run the @mcc@ compiler directly or use the @build-isvr@ Ant task.

To run @mcc@ directly, you need a command like this (which is also documented in the INSTALL file)

<pre>
$ /Applications/MATLAB_R2013b.app/bin/mcc -W "java:uk.ac.soton.isvr,HumanEcho" -d ./scratch -T "link:lib" -v "class{HumanEcho:./mcode/simulateBinauralSignals.m}"
</pre>

The paths will depend on your operating system and MATLAB version.

To use Ant, you just need to run

<pre>
$ ant -f build-isvr.xml
</pre>

However, the paths and suchlike are still system-dependent, so the Ant build file may have the wrong paths in it and may need fixing itself!