How can I use the ToApp/FromApp-function from Simulink?
1 view (last 30 days)
Show older comments
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 Comments
Answers (1)
Subin Kuttappan Stellal Mary
on 4 May 2016
Edited: Subin Kuttappan Stellal Mary
on 4 May 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 Comments
See Also
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!