Problem with creating an .executable program

Hello,
I have a problem. I am creating an .exe file from a code in matlab.
clc
clear
mcc -m file.m
and as a result it is created the file.exe.
But the problem is that my matlab code include one subroutine (I mean in one line has the command:
run calculations.m
), and when I am running the .exe file it shows me an error in this line.
Could you please help me in order to fix it?

Respuestas (1)

Steven Lord
Steven Lord el 6 de Mayo de 2020
I believe you need to explicitly tell MATLAB Compiler to include calculations.m in the executable. This is the problem described in the "Fixing Callback Problems: Missing Functions" section on this documentation page. The easiest way to solve this is probably to remove the run call. Just run the script using its name.
calculations
This way the dependency analysis should be able to detect the call and include it in the executable automatically.

4 comentarios

Ok, I have one problem too. Basically my .exe file that I have created with the command:
mcc -m file.m
in order to run it needs a .txt file , lets call it "data.txt". "data.txt" has only one number. If I want to change the content of the "data.txt" I realise that my .exe file runs with the old content of the "data.txt", and NOT with the new content of the "data.txt".
Can I avoid this ? I mean that I want to execute my .exe file, for any content of "data.txt" , without compiling it again and again.
Could you please help me?
Steven Lord
Steven Lord el 7 de Mayo de 2020
If your application is reading the file to retrieve that one number, it would probably be easier to pass that number into your function as an input argument. One important detail is that the input argument will be received in your application as a char vector not a number. You'll need to convert that into a number (with str2num or the like) as mentioned in the "Using a MATLAB File You Plan to Deploy" section on that page.
Ivan Mich
Ivan Mich el 7 de Mayo de 2020
Editada: Ivan Mich el 7 de Mayo de 2020
The point is that this number of "data.txt" has nothing to do with the function I have mentioned above. Is a separate file tha is used in order to run the program. Thats why I cannot make it.
If I want to run again my exe with the new content of the "data.txt" , in order to make the correct result, I have to compile again the .m code to .exe file.
Is there any way to make it?
Ivan Mich
Ivan Mich el 7 de Mayo de 2020
Editada: Ivan Mich el 8 de Mayo de 2020
my full code is:
clc
clear
data=regexp(fileread('data.txt'), '\r?\n', 'split') .';
data_new=data{1}
calculations.m

Iniciar sesión para comentar.

Categorías

Más información sobre MATLAB Compiler en Centro de ayuda y File Exchange.

Preguntada:

el 6 de Mayo de 2020

Editada:

el 8 de Mayo de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by