user570593
user570593

Reputation: 3520

matlab deploy application paths and other dependencies

I have a matlab code which contains several .m files in sub folders. When I call the matlab I am using the following function.

addpath(genpath('myfolder'));

My code uses some other libraries such as liblinear.

My question is how can I create a matlab executables from my code. How should I add the subfolders and 'addpath'? How can I include my liblinear functions there (from liblinear library/code)?

Upvotes: 1

Views: 476

Answers (1)

Andrey Rubshtein
Andrey Rubshtein

Reputation: 20915

Matlab compiler crawls through your files and figures out the dependencies by himself. Thus, in most case you don't need to do anything. It will add mex files as well (which are in the path), such as liblinear.mex.

However, in some cases the compiler cannot figure out what functions to add to the compiled archive.

  • If you are calling a function using eval.
  • If you are inheritance of objects, you need to add father class(compiler bug)

You need to help him by adding pragma in your .m files:

%#function MyFunc1
...
 eval('MyFunc1');
...

Or adding the files in the compilation command:

mcc .... -a MyFunc1.m 

Upvotes: 1

Related Questions