Editability of Files Packaged into MATLAB Toolbox File (mltbx file)

9 ビュー (過去 30 日間)
Ender
Ender 2021 年 3 月 8 日
回答済み: surya venu 2024 年 4 月 12 日
I need to deliver a MATLAB Toolbox File (extension .mltbx) for a customer. All the files have read / write / execute permissions (including the GettingStarted.mlx file) after the customer installs the mltbx file.
I want the files to be read only in order to protect the install from mistakes that the end user may make. It appears that even when I set the permissions to be read-only just prior to packaging up the .mltbx, the end result is that the files have read / write permissions.
How can I fix this?
Thanks.

回答 (1 件)

surya venu
surya venu 2024 年 4 月 12 日
Hi,
To ensure that the files within the MATLAB Toolbox File (.mltbx) are read-only after installation, you can consider the following steps:
  1. Change the permissions of the files to read-only before packaging the .mltbx file. This can be done using the appropriate command in your operating system. For example, in Windows, you can use the "fileattrib" command to set the read-only attribute for the files.
  2. Modify the MATLAB code to use the "userpath" function to read and write files. This is a recommended workflow in both MATLAB Desktop and MATLAB Online, as it allows for dynamic reading and writing of files without encountering read-only file system errors.
  3. Include a check in your MATLAB code to validate the folder permissions. This can ensure that the folder where the files are installed is writable, and if not, create a new folder with the appropriate permissions.
It is important to note that setting the files to read-only may not be sufficient to prevent modifications if the user has administrative privileges. Therefore, it is recommended to use a combination of these methods to ensure the integrity of the files within the .mltbx file.
Hope it helps.

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by