- Use MATLAB/Simulink Projekt to create your workspace with all files you need in the path
- Replace all your relative path in your code with direct access to file (e.g. load data.mat)
- Compile your app
- To check what looks like your workspace once you start the compiled app, check the content of this folder:
Add resources to compile .m
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
Here is my problem:
- I have a pfile file.p, which call a data.mat file in .\resources\data.mat. I want to have a standalone application of that with .ctf file next to it. I use mcc to compile the both file:
mcc -W main:file -T compile:exe -v .\file.p -a '.\resources\data.mat'
- But I have'nt found a way to make it work:
Error using load
'.\resources\data.mat' is not found in the current folder or on the MATLAB path, but exists in:
***********\Test_compilation
- I can add manually a folder with the .mat file .\resources\data.mat next to my .exe, but is there a way to avoid that and "keep" a folder structure in the .exe ?
I use MATLAB 2017b with Windows 10. Matlab compiler of course.
Best,
Florian
EDIT:
after few test, this is working:
load('resources\data.mat')
And this is not working:
load('.\resources\data.mat')
But in my case, I have a pfile, so I can't modify the code. So I suppose that the data are called with a ".\".
0 Kommentare
Antworten (1)
Nicolas B.
am 2 Dez. 2019
Personnally, I try to always access the files which are encapsulated into my applications without the path.
My advice:
C:\Users\<<your_username>>\AppData\Local\Temp\<<your_username>>\mcrCacheX.X\...
In this folder, you will find the exact workspace used by your app. You can then easily check that all files are included and what they have for path.
0 Kommentare
Siehe auch
Kategorien
Mehr zu MATLAB Compiler finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!