How to compile a matlab program?

조회 수: 263 (최근 30일)
Bijit Banik
Bijit Banik 2011년 3월 6일
댓글: Walter Roberson 2023년 9월 5일
Hello,
I have done a matlab program. Now I want to use it in a matlab free environment (Independent of Matlab)in any computer. Is there anybody who can help me in doing compilation?
Thanks in advance

채택된 답변

Walter Roberson
Walter Roberson 2011년 3월 6일
You need the Matlab Compiler Toolkit . Information about how to use it is available here
Please note that the Matlab Compiler can only produce executables suitable for the platform (Windows, OS-X, Linux) that the compiler was used on, not on "any computer".
Also please note that running the executable requires installing MCR (Matlab Component Runtime) on the system that is to run the executable, and that you as creater of the executable would be responsible for providing MCR to each of the users -- MCR is not available for downloading from Mathworks. You would also be responsible for ensuring that only people authorized to use your executable get MCR from you: it is not allowed to make MCR available outside your organization without access controls to prevent the public from downloading MCR.
  댓글 수: 3
Angelo Sajeva
Angelo Sajeva 2023년 9월 5일
I am not satisfied by this answer
Walter Roberson
Walter Roberson 2023년 9월 5일
In the time since the above answer was written in early 2011:
  • Mathworks introduced MATLAB Coder (about a month after my posting). MATLAB Coder can compile some portions of MATLAB to C or C++ code
  • At some point, Mathworks was able to start making MCR (MATLAB Component Runtime) available for download instead of making it the responsibility of the program compiler to provide it. This did not, however, apply retroactively; for sufficiently old releases there are still license limitations
  • With some work, it became possible (but not straight forward) to install a Linux subsystem for Windows, and use that in combination with MATLAB executing on Windows to generate executables to run on Linux. This is not supported, and might be tricky to set up, but it does reduce the strict operating system limitations I noted
However, if your dissatisfaction has to do with the fact that it is nessary to pay for an optional product to do this... sorry, but that is something that is not likely to change for the forseeable future.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Britech S.A
Britech S.A 2023년 2월 14일
We are now in 2023...we still need to purchase this add-on "Matlab Compiler Toolkit " ?
In the latest version, we can use the program/command "mcc" for building and packaging MATLAB code for deployment ...
Do we still have additional costs to use a MATLAB code in an environment without having to purchase more licenses?
We would like to have a development environment ( with a licensed MatLab installed) from which we have the ability to generate "packages" to run in another environment ( Windows Server ) without having to buy another license...
Is it possible?
Using "mcc" we resolve all this issues?
  댓글 수: 1
Walter Roberson
Walter Roberson 2023년 9월 5일
To compile a MATLAB program, there are a few options:
  • MATLAB Compiler -- produces executables that require MATLAB Component Runtime, most language components are handled, but some toolboxes are not handled at all (such as Symbolic Toolbox)
  • MATLAB Coder -- produces C or C++ code for compiling, fewer language components are supported, graphics are not supported, fewer toolboxes supported, may require modifying code to make it clearer about what array sizes and types are involved
  • Simulink models can be deployed to some hardware targets such as Arduino at no extra cost. This will not support MATLAB in general.
  • more advanced deployment to other hardware might require Embedded Coder
"Do we still have additional costs to use a MATLAB code in an environment without having to purchase more licenses?
YES.
You should probably discuss your needs with the Sales office; for example your might have a situation where MATLAB Production Server would be called for.

댓글을 달려면 로그인하십시오.


Paulo Silva
Paulo Silva 2011년 3월 6일
deploytool

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB Compiler SDK에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by