Can someone help me in connecting Matlab with Android Studio and Mysql?
5 views (last 30 days)
Hi, i need to connect an application that I've created in Android Studio with a code on Matlab. Basically, the user writes some values in the Android application that need to be given in input to the Matlab code, then this code receives the input and gives as output a value that should be displayed on the Android application. I'm using also a Mysql database (on the same pc where i have the codes with Matlab) to store values and to store the different users (every user has a customized code to be used) and I've already made the connection between this one and the Android application. By the way, I can't implement the Matlab code on the Android application, because this code it's customized according to the user that is using the App, so it would be useless to change everytime the application, instead it's better to do this on the main pc. So, i was thinking about making a connection between them using the server.
Making a recap: i would like to send values from Android Studio to a database in MySql, then to send these exact values to the code in Matlab (the code to be used need to be chosen accordingly to the user, in fact there's a table that connect the users with their ID code (the user gives this value in the app) and the specific Matlab code that needs to be used). Then, the results of the code should be sent to the MySql database and then be displayed on the application of the user.
Thank you in advance.
Sutanu Maiti on 5 Aug 2021
Edited: Sutanu Maiti on 5 Aug 2021
You can use Simulink support package for Android Devices to implement the logic along with user input and displaying out in a Simulink model. And then that model can be deployed as a stand alone executable app. Android support package generates, code that can be imported into android studio and then you may add MySql to it. Please follow below example to Import Project to Google Android Studio.
Follow Accept Input from Android Keyboard example to take user input from phone screen.
You can also deploy MATLAB function. PLease follow Detect Boundaries of Objects Within Video Using MATLAB Function Block on Android Device example to do so.
Enhanced Color Replacement with Customized Code example explains how to use FromApp and ToApp blocks to integrate custom Java method in Activity with generated C code.
Hope this helps..