MATLAB 编译器与 MATLAB 编码器 [英] MATLAB Compiler vs MATLAB Coder

查看:70
本文介绍了MATLAB 编译器与 MATLAB 编码器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

两者有什么区别?

据我了解,MATLAB Compiler 将 MATLAB 代码包装成 .exe 文件,这样就可以在不安装 MATLAB 的情况下使用它,并且只需要 MCR.最重要的是,MATLAB Builder NE 还可用于生成与 .Net 框架一起使用的 .Net 程序集,而不是 .exe 文件,但它们仍然需要 MCR.

As far as I understand it, MATLAB Compiler wraps the MATLAB code into a .exe file so that it can be used without installing MATLAB, and only requires the MCR. On top of it MATLAB Builder NE can also be used to produce .Net assemblies to be used with .Net framework instead of the .exe file, but they still require MCR.

现在我不明白 MATLAB Coder 是干什么用的?它生成 C/C++ 代码.但是 MATLAB 代码真的转换成 C/C++ 了吗,还是只是像 MATLAB Compiler 那样打包?是否还需要 MCR 才能运行?

Now I don't understand what MATLAB Coder used for? It generates C/C++ code. But is the MATLAB code really converted into C/C++, or is it merely packaged like in the case of MATLAB Compiler? Does it also need the MCR to run?

我知道这不完全是一个编程问题.但是我在网上搜索了一下,仍然没有找到明确的答案.这些都是非常昂贵的产品,所以我想知道我在做什么.

I understand that this is not exactly a programming question. But I have searched the internet and still haven't found a clear answer. These are very expensive products so I would like to know what I am getting into.

推荐答案

MATLAB Compiler 加密并存档您的 MATLAB 代码(仍为 MATLAB .m 代码),以及将其打包在一个瘦可执行文件(.exe 或 .dll)包装器中.它与 MATLAB Compiler Runtime (MCR) 一起交付给最终用户.如果您愿意,也可以将 MCR 打包在可执行文件中.

MATLAB Compiler encrypts and archives your MATLAB code (which remains as MATLAB .m code), and packages it in a thin executable (either .exe or .dll) wrapper. This is delivered to the end user along with the MATLAB Compiler Runtime (MCR). If you wish, the MCR can be packaged within the executable as well.

MCR 可自由重新分发,您可以将其视为没有前端桌面的 MATLAB 本质上的副本.

The MCR is freely redistributable, and you can think of it as essentially a copy of MATLAB without a front-end desktop.

当用户运行可执行文件时,它会解压缩和解密 MATLAB 代码,然后针对 MCR 而不是 MATLAB 运行它.因此,通过这种方法交付的应用程序的运行方式应该与它们在 MATLAB 中的运行方式完全相同(包括相同的速度).

When the user runs the executable, it dearchives and decrypts the MATLAB code, and runs it against the MCR instead of MATLAB. Applications delivered via this method should therefore run exactly the same as they do within MATLAB (including the same speed).

MATLAB Coder 将 MATLAB 语言的子集转换为 C 代码.然后可以以多种不同的方式使用它,包括作为 mex 文件带回 MATLAB,使用 C 编译器编译以从另一个应用程序调用,或传送到嵌入式设备.由于它是 C 代码而不是 MATLAB 代码,因此它通常(尽管并非总是)比原始 MATLAB 代码运行得快得多.C 代码不需要 MCR.MATLAB 语言支持的子集非常广泛,但在提交此工作流之前,您需要了解一些值得注意的限制.生成的代码是 C 代码,但如果您需要使用 C++ 编译器而不是 C 编译器,它可以生成 C++ 包装器.

MATLAB Coder converts a subset of the MATLAB language into C code. This can then be used in many different ways, including being brought back into MATLAB as a mex file, compiled with a C compiler to be called from another application, or delivered to an embedded device. Since it is C code rather than MATLAB code, it will often (though not always) run much faster than the original MATLAB code. The C code does not require the MCR. The supported subset of the MATLAB language is very extensive, but there are a few notable restrictions that you would want to look into before committing to this workflow. The code produced is C code, although it can produce a C++ wrapper if you have a need to use a C++ compiler rather than a C compiler.

MATLAB Compiler 适用于您希望简单且(相当)直接地与没有 MATLAB 副本的人共享您编写的 MATLAB 应用程序的用例.由于部署的.m代码是经过加密的,在保护知识产权的同时也可以用来共享MATLAB代码.

MATLAB Compiler is intended for the use case that you want to simply and (fairly) straightforwardly share a MATLAB application that you've written with someone who does not have a copy of MATLAB. Since the deployed .m code is encrypted, it can also be used to share MATLAB code while protecting intellectual property.

MATLAB Coder 有其他用例,例如希望通过转换为 mex 文件来加速 MATLAB 代码,或者需要为另一个应用程序或嵌入式设备生成 C 代码.

MATLAB Coder has other use cases, such as wanting to speed up MATLAB code by converting to a mex file, or needing to produce C code for another application or an embedded device.

如果您有更详细的问题,我真的建议您致电 MathWorks 并询问.

If you have more detailed questions, I would really recommend that you just call up MathWorks and ask them.

编辑:以上信息适用于 MATLAB R2014b 及以下版本.从 MATLAB R2015a 开始,MATLAB Compiler 的功能已与 MATLAB Builder 产品的功能重新混合,并且还有一个新产品 MATLAB Compiler SDK>.

Edit: The information above is correct for versions of MATLAB R2014b and below. As of MATLAB R2015a, functionality from MATLAB Compiler has been remixed with functionality from the MATLAB Builder products, and there is also a new product MATLAB Compiler SDK.

从 R2015a 开始,MATLAB 编译器的工作方式与上述相同(即加密、存档和打包,但不生成 C),但现在将打包为 .exe 和 Excel加载项 (.xla).在 R2015a 之前,此功能曾经存在于产品 MATLAB Builder EX for Excel 中.

As of R2015a, MATLAB Compiler works in the same way as described above (i.e. encrypt, archive and package, but not producing C), but will now package as .exe, and as an Excel add-in (.xla). Prior to R2015a, this functionality used to be present in the product MATLAB Builder EX for Excel.

从 R2015a 开始,MATLAB 编译器不再生成 .dll 组件.此功能已移至新产品 MATLAB 编译器 SDK,其中还包括生成 .NET 程序集和 Java 类的功能.在 R2015a 之前,此功能曾经出现在产品 MATLAB Builder NE for .NETMATLAB Builder JA for Java 中.

As of R2015a, MATLAB Compiler no longer produces .dll components. This functionality has been moved to the new product MATLAB Compiler SDK, which also includes functionality to produce .NET assemblies and Java classes. Prior to R2015a, this functionality used to be present in the products MATLAB Builder NE for .NET and MATLAB Builder JA for Java.

换句话说:

在 R2014b 及更低版本中,我们有:

In R2014b and below, we had:

MATLAB Compiler:生成 .exe 和 .dll 组件

MATLAB Compiler: produce .exe and .dll components

MATLAB Builder NE for .NET:生成 .NET 程序集

MATLAB Builder NE for .NET: produce .NET assemblies

用于 Java 的 MATLAB Builder JA:生成 Java 类

MATLAB Builder EX for Microsoft Excel:生成 Excel 插件.

MATLAB Builder EX for Microsoft Excel: produce Excel add-ins.

在 R2015a 中,我们有:

In R2015a, we have:

MATLAB Compiler:生成 .exe 和 Excel 插件

MATLAB Compiler: produce .exe and Excel add-ins

MATLAB Compiler SDK:生成 .dll、.NET 程序集和 Java 类.

MATLAB Compiler SDK: produce .dll, .NET assemblies and Java classes.

MATLAB Coder 的范围和用例在这些版本中没有变化(尽管有新功能).

The scope and use-cases of MATLAB Coder have not changed across these releases (although there are new features).

编辑:从 R2015b 开始,MATLAB Compiler SDK 还生成 Python 包.

Edit: As of R2015b, MATLAB Compiler SDK also produces Python packages.

关于区分可在此处找到适用于 C/C++ 的 MATLAB 编码器和 MATLAB 编译器.

不同的对比表用于代码生成的 MATLAB 产品.

这篇关于MATLAB 编译器与 MATLAB 编码器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆