Alternative Custom Model Languages#
In this example, we setup a custom layers problem using three different programming language (MATLAB, Python, and C++) to write the custom model function. The provided C++ function needs to be compiled into a dynamic library using instructions given in Custom Models in Python or C++ or instructions specific to your compiler.
This example can be run using the instructions below.
Note
The custom models used are - examples/miscellaneous/languages/alloyDomains.m, examples/miscellaneous/languages/alloyDomains.m, examples/miscellaneous/languages/alloyDomains.m.
Warning
For Python custom functions, you will need to setup the python environment for MATLAB, see Setup MATLAB to use Python
Run Script:
root = getappdata(0, 'root');
cd(fullfile(root, 'examples', 'miscellaneous', 'alternativeLanguages'));
customModelLanguagesScript
Run Interactively:
root = getappdata(0, 'root');
cd(fullfile(root, 'examples', 'miscellaneous', 'alternativeLanguages'));
edit customModelLanguagesSheet.mlx
Note
The custom models used are - RATapi.examples.languages.custom_bilayer.cpp, RATapi.examples.languages.custom_bilayer.py, RATapi.examples.languages.custom_bilayer.m.
Warning
For MATLAB custom functions, ensure MATLAB and matlabengine are installed Installation.
Run Script:
python RATapi.examples.languages.run_custom_file_languages.py