Utilizing Matlab code in Android Application?
Show older comments
Hello! I am trying to utilize Matlab code somehow with an Android application. I am using the Signal Processing Toolbox to calculate walking pattern information from the accelerometer and gyroscope (specifically I'm calculating # of Steps, Cadence, Skew, Kurt, Gait Velocity, Residual Step Length, Ratio, Residual Step Time, Bandpower, SNR, THD, XZ Sway Area, YZ Sway Area, XY Sway Area, and Sway Volume).
I tried to create a Matlab JAR to put into the application, but I couldn't get it to actually properly use the JAR file. I kept getting a NullPointerException that was in reference to the MCR, and I believe this issue is because the MCR cannot be put on an Android phone (can someone confirm this?).
I also tried converting the code to C using the Matlab C Compiler, but most of my features I'm generating (the ones listed in the parentheses above) weren't able to be converted over.
Is there any way that I can use this Matlab code in my Android application? Whether it involves setting up a server, putting the code on that server, and having the application use that server to run the Matlab code, or another solution if one exists? (Preferably one that doesn't involve using a server and is actually just run on the phone?)
Would really love any help anyone can give.
Thank you!
Answers (2)
Walter Roberson
on 4 Apr 2016
0 votes
MATLAB Compiler and MATLAB Compiler SDK are limited to the operating systems supported by MATLAB, which are x86 and x64 architectures on MS Windows, OS-X or Linux. Android uses a variety of CPUs, none of which are that architecture (ARM processors are common.)
MATLAB code that is put into a Simulink MATLAB Function Block (with appropriate adjustments made) can be generated for Android target using Simulink. There are a bunch of restrictions on this, but I think it can access the Android Sensor information for supported devices (Galaxy S4, Galaxy Note 2)
MATLAB Coder can generate C/C++, but there are a bunch of restrictions on this.
abhiraj
on 5 May 2024
0 votes
i am student from in india
Categories
Find more on Modeling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!