如何将 Matlab 代码库与 Android 集成? [英] How to integrate Matlab code library with Android?

查看:45
本文介绍了如何将 Matlab 代码库与 Android 集成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 MATLAB 中有一个算法和一些其他代码,我想在我的 Android 应用程序中使用它.

I have an algorithm and some other code which is in MATLAB and I want to use it in my Android application.

我该怎么做?

  • 我可以从 MATLAB 制作一个用于 Android 的 jar 文件吗?
  • 我还得做点别的吗?

推荐答案

如果您有其他产品,MATLAB Builder JA for Java,您可以从您的 MATLAB 代码生成一个 .jar 文件.

If you have an additional product, MATLAB Builder JA for Java, you can produce a .jar file from your MATLAB code.

但是,.jar 文件需要存在 MATLAB Compiler Runtime(您可以通过 MATLAB Compiler 和 MATLAB Builder 产品获得的可自由再分发的组件).MCR 的占用空间比适用于典型 Android 设备的占用空间大得多(它就像 MATLAB 本身的副本,没有用户界面).

However, the .jar file requires the MATLAB Compiler Runtime (a freely redistributable component that you get with MATLAB Compiler and MATLAB Builder products) to be present. The MCR has a much larger footprint than is suitable for the typical Android device (it's like a copy of MATLAB itself, without the user interface).

你可以考虑一下

  1. 在服务器上远程运行您的 MATLAB .jar 文件,并让您的 Android 应用程序连接到它,或者
  2. 不要使用 MATLAB Compiler 和 Builder 产品,而是使用 MATLAB Coder,它将把 MATLAB 语言的一个子集直接转换成 C 代码.此 C 代码不需要 MCR,可以编译为直接在 Android 上运行.确保您的 MATLAB 算法属于或可以用 MATLAB 语言的适当子集表达.
  1. Running your MATLAB .jar file remotely on a server, and having your Android application connect to it, or
  2. Instead of using MATLAB Compiler and Builder products, use MATLAB Coder, which will convert a subset of the MATLAB language directly into C code. This C code doesn't require the MCR, and could be compiled to run directly on Android. Make sure your MATLAB algorithm falls within, or can be expressed in, the appropriate subset of the MATLAB language.

<小时>

从 R2015a 开始,MATLAB Builder JA for Java 的功能已被新产品 MATLAB 编译器 SDK.

这篇关于如何将 Matlab 代码库与 Android 集成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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