How can I use the ToApp/FromApp-function from Simulink?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello everybody!
I work on a project to control a motor via an app on android. Therefore I have already written an app in java to use an IOIO-Board to control the motor manually. Furthermore I want to use Simulink to read-out the acceleration sensor of the smartphone and convert this data into distance. So I can reach a specific position later. So far so good.
My problem is that I do not know how to use the ToApp-function from Simulink to send the data from a Simulink-app to my existing app. I do not know how to write the function in java to gather this data and the help in Simulink is not very helpful to me.
I use the Samsung Galaxy S5/Google Nexus 5 with Android 4.4.2/5.0, an IOIO-Board and MATLAB R2014a/Simulink and the Simulink support package for Samsung Galaxy Android Devices.
I hope someone can help me with my question.
Best regards, Max
0 Kommentare
Antworten (1)
Subin Kuttappan Stellal Mary
am 4 Mai 2016
Bearbeitet: Subin Kuttappan Stellal Mary
am 4 Mai 2016
Refer this link :
As a starting point, use the following code to get the data to Java code. Note that 'FilteredData' is the method name I have given in the ToApp block parameters :
public void FilteredData (float[]a) {
for(int i=0;i<a.length;i++){
Log.d("SensorData",i+":"+a[i]);
}
}
0 Kommentare
Siehe auch
Kategorien
Mehr zu Modeling finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!