adi
adi

Reputation: 19

Error in Compiled exe, but running in m file MATLAB

I have build a program that run properly in m file MATLAB. but when I compile to exe using Matlab compiler, some function didn't work. here is the error command window show on matlab execute program

undefined function or method 'maple' for input arguments of type 'char'
error in ==> function_a at 5

codes on function_a.m is

function function_a(msg)
format long

%parameter p & q
maple('z1:=',randint(1,1,[12 20])); %these run  in m.file, but not in exe compile
p=maple('nextprime(z1)');
p=str2double(p);

is there any solution for that?please need your advice, many thanks

Upvotes: 0

Views: 1253

Answers (2)

Sam Roberts
Sam Roberts

Reputation: 24137

The command maple is from Symbolic Toolbox, which is not supported by MATLAB Compiler. You will not be able to successfully compile and run your program.

What's happened is that the maple command is not allowed to be compiled, so when the .exe runs, it can't find the function maple, and gives you the error you're seeing. It would be nice if MATLAB gave you a more informative error message, but it seems it doesn't.

Upvotes: 1

Dennis Jaheruddin
Dennis Jaheruddin

Reputation: 21561

Assuming you have tried to compile the version from exactly this sourcecode and that you call it twice with exactly the same input, it appears that MATLAB simply does not realize that the function maple will be used by you.

I have had this before with some project, eventually I decided to use the 'add additional resource to project' option in deploytool.

Depending on your needs you can either just add the function, or the folder containing this function.

Upvotes: 1

Related Questions