How can P-coded files be used in a MATLAB Compiler deployed standalone application?
13 次查看(过去 30 天)
显示 更早的评论
MathWorks Support Team
2017-4-14
编辑: MathWorks Support Team
2024-8-31
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.
采纳的回答
MathWorks Support Team
2024-8-31
编辑:MathWorks Support Team
2024-8-31
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 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!