0
votes

I am discovering the coder tool in Matlab. some of my code was successfully converted but it fails in functions which contain the functions "sym" for symbolic and "perms" for permutations. Also I seem to get an error when I save the answer "ans" of for example "A==B". Any idea how to solve this problem?

Thank you for your help

Here is an example of parts of my matlab function that cannot be transformed into c++ with coder:

b=4;
s=2;
one=ones(factorial(b),1);
two=2*ones(factorial(b),1);
B=perms(s+1:b+s);

S=[one,two,B];
sz=size(S);

%%%%%%%%%%%%%%%%%%%

L=[1,3;1,4;1,5;1,6;2,3;2,4;2,5;2,6];
x=perms(1:8);
M=[];
1

1 Answers

3
votes

Some toolbox functions cannot be compiled, i.e. they can only be run from a MATLAB session. The following post tells us that functionality in the Symbolic toolbox cannot be compiled.

http://se.mathworks.com/matlabcentral/answers/96441-why-am-i-unable-to-compile-functions-from-the-symbolic-math-toolbox

So most likely this is the reason why you are running into problems when you try to run it in compiled form.

More info about compiler support for various toolboxes can be found here:

http://se.mathworks.com/products/compiler/supported/compiler_support.html

Symbolic Math toolbox does not appear on the list and any toolbox that is not listed is not supported (i.e. cannot be compiled).