Why do I get an "Error using matlabshar​ed.mldatx.​internal.g​etApplicat​ion" when my .mldatx application file is not placed in the current folder (but on the MATLAB search path) in Simulink Real-Time R2020a?

1 view (last 30 days)
I have an issue with deploying my application to the target using the MATLAB API.
If I use the load command from the MATLAB API I get the error message:
Error using matlabshared.mldatx.internal.getApplication
Unable to read file 'my_model.mldatx'.
Error in https://protect-us.mimecast.com/s/kTXCAIEZB2hoz9QBF5KCTh?domain=simulinkrealtime.target
Error in testUI/DownloadButtonPushed (line 2345)
load(app.tg, 'my_model'); % Download application to target
The same application works if I use the external mode to deploy the application.
The file my_model.mldatx is on the project path, so it can be resolved. This was tested using
>> which('my_model.mldatx')
When I close the project and let Simulink create all build artifacts in the current folder, loading does work.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 15 Nov 2021
This happens because we either need to be in the directory where the application file is located when we call "tg.load', or we need to specify the relative/absolute path to the application. 
For instance, if you are working out of the "work" directory in your project and the application file is in the "codegen" sub-directory, you could call:
>> tg.load('codegen/sea_llc')
For example, you could use something like this in your code:
[pth,file] = fileparts(which('my_model.mldatx'));
load(app.tg, [pth,'\',file]);


More Answers (0)

Categories

Find more on Troubleshooting in Simulink Real-Time in Help Center and File Exchange

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!