Program running in m file, but not in exe after compiling using Matlab Compiler

4 visualizzazioni (ultimi 30 giorni)
Hi everyone, 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

Risposta accettata

Walter Roberson
Walter Roberson il 4 Feb 2014
The Symbolic Toolbox functions cannot be compiled, and that applies whether you used the older Maple based toolbox or the newer MuPAD based toolbox.
If you are not using Symbolic Toolbox, but have installed a full Maple and allowed it to add in symbolic hooks in MATLAB, then still it cannot be compiled.
randint() can be replaced by using MATLAB's randi([12 20]) or (older MATLAB)
(12 + floor((20-12+1) * rand))
nexprime is a bit more tricky to replace, but you could use
p = primes(23); %first prime after your maximum value
p(find(p >= z1, 1, 'first'))
  2 Commenti
Bakka
Bakka il 4 Feb 2014
Hi Mr. Walter, is there any solution for these problem? because not only those codes, but there are some function m file that using 'maple'
Need your advice again, many thanks
Bakka
Bakka il 4 Feb 2014
Mr. Walter, I have change the code that you suggest before, it just like this below, isn't right?
maple('z1:=',(12 + floor((20-12+1) * rand)));
p = primes(23); %first prime after your maximum value
p(find(p >= z1, 1, 'first'));
p=str2double(p);
old code is
maple('z1:=',randint(1,1,[12 20]));
p=maple('nextprime(z1)');
p=str2double(p);

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su C Shared Library Integration in Help Center e File Exchange

Prodotti

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by