简体   繁体   中英

Coder on Matlab to C++ , sym and perms function?

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=[];

Some toolbox functions cannot be compiled, ie 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 (ie cannot be compiled).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM