How can P-coded files be used in a MATLAB Compiler deployed standalone application?
6 views (last 30 days)
Show older comments
MathWorks Support Team
on 14 Apr 2017
Edited: MathWorks Support Team
ongeveer 5 uur ago
I have P-coded files that I would like to share with another user. This person wants to use them in a deployed application created by the MATLAB Compiler. How can they use my P-files in their application without having access to the source M-files?
They have tried compiling the P-code. But the deployed application executes with errors. The result is different from running the P-code inside MATLAB Desktop.
Accepted Answer
MathWorks Support Team
on 31 Aug 2024 at 0:00
Edited: MathWorks Support Team
ongeveer 5 uur ago
P-code is entirely opaque during dependency analysis. The run time errors may be due to missing dependencies during the compilation.
In order for another person to use your P-files in a standalone application, you will need to use the following tool which generates the associated dependency analysis and store this as function pragmas in another M-file:
After downloading this tool, please follow the steps below for analyzing a single MATLAB file (named "my_function.m" in this example):
1. Run the function call to create a file having function pragmas of dependent files like this:
>> createRequiredFunctionPragmasFile('function_list.m', 'my_function.m');
2. The function pragmas of dependent files will be in the "function_list.m" file. Distribute this "function_list.m" file along with p-coded file for "my_function" to the end user.
3. The end user will need to include the function pragmas file in the deployable archive when creating the compiled application.
To do this using the MCC command, they will need to use the "-a" flag similar to the following:
>> mcc -m my_app.m -a function_list.m
To do this using the Application Compiler, they will need to add the "function_list.m" file to the "Files required for your application run" section.
For more information and use cases, download the tool and consult the associated documentation in the "createRequiredFunctionPragmasFile.pdf" file.
0 Comments
More Answers (0)
See Also
Categories
Find more on Standalone Applications in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!