Frequently Asked Questions: MATLAB Compiler

50 visualizaciones (últimos 30 días)
Some of the Frequently Asked Questions in MATLAB Compiler are:
  • Where can I find example code to compile
  • Can an application be deployed from one type of platform to another?
  • Will compiling M-code speed up its execution?
  • What limitations does MATLAB Compiler have (What are the limitations and restrictions for MATLAB Compiler)?
  • Do I have to list all dependent M-files when compiling?
  • What is CTF Archive and where does it reside?
  • Why do I get error, “No supported compiler or SDK was found” when I run “mex -setup” or “mbuild -setup”?
  • Why does my code work in MATLAB but does not work in a compiled application?
  • How do I install MinGW for use in MATLAB?
  • I did not find relevant information from FAQs above. Where else can I find more information?

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 19 de Mayo de 2023
Editada: MathWorks Support Team el 19 de Mayo de 2023
Where can I find example code to compile?
  • Examples located in <matlabroot>\extern\examples\compiler
  • Examples in documentation
Can an application be deployed from one type of platform to another?
  • The compiled applications are not cross-platform compatible (cannot go from Windows to Linux)
  • Inner-platform compatibility exists (can go from one supported Windows to another supported Windows)
  • JARs generated using Builder JA are generally platform independent, only if they do not use MEX files internally (as those are platform dependent)
Will compiling M-code speed up its execution?
  • Compiled code should run the same either in stand-alone mode or in MATLAB.
What limitations does MATLAB Compiler have (What are the limitations and restrictions for MATLAB Compiler)?
  • Most prebuilt GUIs included with MATLAB will not compile. Examples: IMAQTOOL, CFTOOL, TMTOOL will not compile.
  • A list of unsupported functions can be found here.
  • Some toolboxes are unsupported or contain unsupported functions: see this documentation
  • This  is the list of non-compilable features in the toolboxes.
  • Simulink functions in general are not compilable.
Do I have to list all dependent M-files when compiling?
  • No. MATLAB compiles all dependent M-files along with main one.
  • Exception is when function is called from within a string, as in FEVAL or in a callback function
  • Function should be found if a function handle (@) is used and this is the recommended method.
  • A workaround to include functions being called using FEVAL is to calling "%#function hidden_func" from main M-function: see document
  • You can also explicitly list the function in your call to MCC: "mcc -m mainfunc -a hidden_func"
What is CTF Archive and where does it reside?
  • The CTF archive contains encrypted versions of all the .m, p, .mex files required by your program (not applicable to excel files, txt files data files etc.)
  • The CTF archive is located at ‘mcrcacehdir’ and the default location would be ‘C:\Users\<Username>\AppData\Local\Temp\<username>\mcrCache<version>’
Why do I get error, “No supported compiler or SDK was found” when I run “mex -setup” or “mbuild -setup”?
  • This error means that either no supported compiler was installed or it was not setup properly.
  • Refer this list and ensure that a supported compiler for your MATLAB Release and Operating System is installed.
Why does my code work in MATLAB but does not work in a compiled application?
  • MATLAB Compiler supports the full MATLAB language including objects, most MATLAB toolboxes, and user-developed user interfaces. This list shows the MATLAB toolboxes that you can use with MATLAB Compiler and describes which functionality can and cannot be compiled.
  • Functions that cannot be compiled fall into the following categories:
  • Functions that print or report MATLAB® code from a function, for example, the MATLAB help function or debug functions, will not work.
  • Simulink® functions, in general, will not work.
  • Functions that require a command line, for example, the MATLAB look for function, will not work.
  • clc, home, and savepath will not do anything in deployed mode.
  • Tools that allow run-time manipulation of figures
  • Refer this list of unsupported functions and programs by MATLAB Compiler
How do I install MinGW for use in MATLAB?
  • MATLAB only supports specific versions of MinGW. R2017b supports MinGW 5.3, while R2017a and prior support MinGW 4.9.2. Other versions of MinGW downloaded from third party sources are not qualified to work with MATLAB. Installation instructions for the various release follow:
*R2015b and R2016a:
This installer requires a MathWorks account and involves registration/configuration after the installation, which will allow MATLAB to recognize MinGW. 
*R2016b - R2017b: 
Search for "MATLAB Support for the MinGW-w64 C/C++ Compiler from TDM-GCC" in the MATLAB Add-ons menu. You can then install the support package from the Add-on explorer.
More information on accessing the Add-ons menu can be found in the following documentation:
Run below command in MATLAB 2017b for documentation:
>> web(fullfile(docroot, 'matlab/matlab_env/get-add-ons.html'))
Or for latest release documentation accessing the Add-ons menu, please refer to:https://www.mathworks.com/help/matlab/matlab_env/get-add-ons.html
I did not find relevant information from FAQs above. Where else can I find more information?
  • MATLAB Answers is a great place to look for similar issues faces by other customers.
  • If you cannot find an answer, contact Support.

Más respuestas (0)

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by