To build an application using MATLAB code, you can use
the BioLib-MATLAB-Coder-Toolchain to compile the MATLAB
code to a BioLib-compatible WebAssembly executable.
First download the project or clone it from GitHub here. To
setup the toolchain, open the project in MATLAB.
Add the biolib-matlab-coder-toolchain and biolib-matlab-coder-toolchain/registry folders to the MATLAB path. You can
do this in MATLAB by right-clicking on the folder and selecting Add to Path. This is required for the toolchain to
be registered. Make sure that the root directory is a path without spaces and not a mapped network drive.
Next, run the following code to download the Emscripten tools into the Add-On directory.
After this, install version 1.39.8 of the Emscripten tools in the selected directory.
!emsdk\emsdk.bat install 1.39.8-upstream
case isunix || ismac
!./emsdk/emsdk install 1.39.8-upstream
If you have not already installed MATLAB Coder™, install instructions can be
found here. Now generate the BioLib
toolchain and register it with MATLAB Coder™. Your MATLAB code needs to be supported by MATLAB Coder in order to be
compiled using this toolchain.
In the above example, the input arguments are a string with the format -i [DNA_STRING] where -i is the key
and [DNA_STRING] the value. We split the parameter string in the example, and assign each position to a variable.
Note, that each argument to be entered in the final application need a key to be passed from BioLib.
To show the output, you can (1) print them as stdout or (2) write them to a file. Use the exit code out = 0; to
indicate that the application ran successfully.
Finally, run the below code to produce a WebAssembly file that runs on BioLib.
To view a full example of the required commands, see the setup.mlx
The last step is to upload the WebAssembly file, biolib_main.wasm, as an Emscripten module to a BioLib application.
You can see an example of this here.
Further MATLAB Resources and Training
To learn more about MATLAB a number of useful resources are freely available online.
Getting Started with MATLAB is the central resource
page to learn how to use MATLAB. You can find a dedicated page for general tutorials at
the MATLAB and Simulink Tutorials page. And there
is also a number of free, self- paced, interactive MATLAB tutorials that run through the browser (no download required).
These “Onramp” courses offer approximately two hours of training on many topics. See for example: