How do i use and -s flag for compiling a MATLAB app

12 ビュー (過去 30 日間)
Noam Ouzana
Noam Ouzana 2021 年 11 月 4 日
回答済み: David Leffingwell 2023 年 6 月 12 日
I want to compile a Matlab app, and I'd like to keep some of the functions written for the code unreadable.
I read that I can use a "-s" flag to obfuscate the code, but didn't manage to use it properly. How can I do it?

回答 (3 件)

Navya Singam
Navya Singam 2021 年 11 月 8 日
Hi,
For obfuscating the code, you can use the "pcode" function in MATLAB. It converts the .m file to P-file, which is content-obscured and execute-only form of MATLAB code.
Syntax for creating P-file
pcode(item) %% creates a item.p P-file for the item.m file
Refer to pcode documentation for more information on how to use "pcode" function.

Walter Roberson
Walter Roberson 2021 年 11 月 8 日
You can add the -s option to the mcc command line.
If you are using applicationCompiler then click on the Settings button, and in the section that comes up marked "Additional parameters passed to mcc:" type in
-s
  2 件のコメント
Noam Ouzana
Noam Ouzana 2021 年 11 月 8 日
Thank you for your answer! But it doesn't seem to recognize this specific flag for some reason. I am using Matlab R2021b.
Also, I want to package a Matlab app, (maybe the term 'compile' wasn't the right one), and there doesn't seem to be a way to prompt mcc commands while packaging.
David Leffingwell
David Leffingwell 2023 年 6 月 12 日
Use the "-j" switch to the MATLAB Compiler to automatically convert all M files to P-code (in R2022b or later)
The "-s" option of the MATLAB Compiler doesn't obfuscate the M code, it obfuscates the file and folder structure inside the package and also supports encryption of data files.

サインインしてコメントする。


David Leffingwell
David Leffingwell 2023 年 6 月 12 日
Use the "-j" switch of the MATLAB Compiler to automatically convert all M files to P-code (in R2022b or later)

カテゴリ

Help Center および File ExchangeMATLAB Compiler についてさらに検索

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by