MATLAB Answers

Implementing code from MatLab into Android Studio?

39 views (last 30 days)
Tiffany Chen
Tiffany Chen on 16 Feb 2020
Answered: Sruthi Yenugula on 18 Feb 2020
I created an image segmentation algorithm over the past summer in MatLab. However, this algorithm only allows it to be run on my laptop. I want to implement this code into an app on Android Studio. I have already set up the app design/layout and code on Android Studio and plan on just incorporating the algorithm and then running the entire thing on a virtual device in Android Studio. I'm just having trouble trying to figure out how to implement the code from MatLab into something like Android Studio which is a platform for Kotlin and Java. Can someone give me a detailed explanation on how to do this?
I was initially thinking of using MATLAB Compiler to convert the code to Java packages so I could use them in Android Studio, but I'm not exactly sure if that's how it works. Please help if you can!
Thanks!

Answers (1)

Sruthi Yenugula
Sruthi Yenugula on 18 Feb 2020
Hi Tiffany,
1) You can use Simulink Support Package for Android Devices to convert a Simulink Model to Android Application. You can embed your MATLAB code in MATLAB function block and use this with other Android Blocks and create Android Applications with one Click. You use Camera and Video Display blocks of Android Support Pacakage.
2) If any of the functions are not codegen supported, then you can use external mode to communicate between Simulink and Android device.
Following are the some of the examples which uses MATLAB function block

Community Treasure Hunt

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

Start Hunting!