Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to integrate Matlab code library with Android?

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

How can I do this?

  • Can I make a jar file from MATLAB for use with Android?
  • I have to do something else?
like image 397
Azhar Avatar asked Mar 12 '12 06:03

Azhar


People also ask

Can MATLAB be used in Android?

The MATLAB® Mobile™ app is available from the Google Play™ store on the Web. To download the MATLAB Mobile app: Tap the Google Play icon on your device.

Can you make mobile apps with MATLAB?

One option is to use MATLAB Coder, which generates C code from your MATLAB algorithm. You can then integrate the generated C code into your iOS and Android apps. Here's a webinar and example code that shows this workflow: MATLAB to iPhone and Android Made Easy.

Can I use Simulink in Mobile?

Simulink® Support Package for Android™ Devices lets you program and run algorithms on Android smartphones and tablets.

Can we use MATLAB online on mobile?

Connect to MATLAB from your iPhone, iPad, or Android device Connect to a MATLAB® session running on MathWorks Cloud.


2 Answers

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

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).

You could think about either

  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.

Edit: As of R2015a, functionality from MATLAB Builder JA for Java has been replaced by a new product, MATLAB Compiler SDK.

like image 154
Sam Roberts Avatar answered Oct 23 '22 15:10

Sam Roberts


I am the developer of Addi. http://addi.googlecode.com Addi is quickly becoming a full port of Octave (which is an open source tool that uses Matlab syntax). Addi is going to have intents for other applications to use it as their math engines or plotting engines. So, if you can run your code on Octave, then very soon you will be able to run it on Android.

like image 28
corbin Avatar answered Oct 23 '22 13:10

corbin