Programmatic compilation of standalone windows app from Matlab project (similar to matlab.addons.toolbox.packageToolbox)?
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi, I finally managed to migrate my toolbox project to R2025a. As soon as everything works, the new Matlab version is really nice.
Here is my question: I have a Matlab project for my code. Under "Manage tasks", I made two tasks - one to generate a toolbox from my code, and another one to generate a standalone (windows) application from the same code. These two tasks work if I open them and then click on "package".
But ideally, I would like to do this programatically via the buildfile ("Run Build"). I can do it already for the toolbox using
matlab.addons.toolbox.ToolboxOptions("MyMatlabProjectFile.prj")
and
matlab.addons.toolbox.packageToolbox("MyMatlabProjectFile.prj")
But I would also like to do this for the standalone app. I do not find how to do this.
compiler.project.StandaloneAppConfigurationOptions
compiler.project.getStandaloneDesktopAppConfiguration
Although the above lines sound promising, these functions don't accept any inputs
And
compiler.build.standaloneWindowsApplication(AppFile)
does not accept a prj file as input.
Is there a way to compile a standalone app based on the task I created for my project? Thanks for your input!
1 Commento
Gayathri
il 5 Giu 2025
Please load the project in command line using the following command:
proj = matlab.project.loadProject('filename.prj');
Currently, we cannot directly pass the ".prj" file to the "compiler.build.standaloneApplication" function. Instead, please specify the main application file that serves as the entry point for your standalone application.
appFile = 'MyMainApp.m'; % Replace with your main app file name
% Create Standalone Application Options
opts = compiler.build.StandaloneApplicationOptions(appFile, ...
'OutputDir', 'C:\Path\To\Output\Directory', ... % Specify your output directory
'ExecutableName', 'MyStandaloneApp', ... % Name of the executable
'Verbose', 'On'); % Enable verbose output
% Build the standalone application
compiler.build.standaloneApplication(opts);
Let me know if this works and you get the expected results.
Risposte (0)
Vedere anche
Categorie
Scopri di più su Standalone Applications in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!