- https://www.mathworks.com/help/releases/R2024a/compiler/compiler.package.installer.html
- https://www.mathworks.com/help/releases/R2024a/compiler/compiler.build.standaloneapplication.html
Can I make Matlab Compiler give me %SystemDrive% as a Default Install Location option?
4 次查看(过去 30 天)
显示 更早的评论
The Matlab applications that I am creating are being used by multiple people across multiple accounts on the computers that they are installed on. There are certain limits and criteria that I am handling through the use of *.json files that are installed to the same directory as the program. The issue with installing these applications to %ProgramFiles% is that the user needs admin permissions to change anything inside of the *.json files, and due to the Group Policies that we are under, a standard user does not possess the correct permissions for this.
Is there a way that I can manually add the option for %SystemDrive% or %ProgramData% to the Matlab Compiler's list of available options for a Standalone Application? The IT department does not fully understand the installations and the water gets very muddy once they start messing with the filepaths.
The current way I am getting around this is by updating the *.prj file with any new changes when a new release is built, using the createDeploymentScript function to generate a deployment script, and manually changing the %ProgramFiles% or %AppData% in the "packageOpts.DefaultInstallationDir" to %SystemDrive%. This gets the job done, but is cumbersome and very prone to human error when anyone else (who is unfamiliar with the Matlab Compiler program) is attempting a new build.
NOTE: I cannot install to the %AppData% Directory as when an admin remotes in to install the program, it defaults to their %AppData% folder and thus not all users have access to this location.
Any help would be greatly appreciated!
0 个评论
回答(1 个)
Madheswaran
2024-7-11
Hi,
While using the ‘Application Compiler’ app to create applications, the default installation paths are ‘%ProgramFiles%’ and ‘%AppData%’. However, while installing the application created using MATLAB, the end user can still select the installation location of their choice.
You can create an installer with a specific install location using the function `compiler.package.installer` with option 'DefaultInstallationDir' and the corresponding default installation directory path.
Please follow the below mentioned MATLAB R2024a code that demonstrates the suggested solution:
mainScript = 'main_script.m';
additionalFiles = {'dependency_files.m'}; % Include additional files required by the main script
% Build the standalone application
buildResults = compiler.build.standaloneApplication(mainScript, ...
'AdditionalFiles', additionalFiles, ...
'OutputDir', 'output');
% Package the built application into an installer
compiler.package.installer(buildResults, ...
'DefaultInstallationDir', 'C:\MyOwnApp'); % Set the default installation directory
Please refer to the below mentioned MATLAB R2024a documentations on ‘compiler.package.installer’ and ‘compiler.build.standaloneApplication’:
Hope this helps!
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!