How can I use the ToApp/FromApp-function from Simulink?

조회 수: 5 (최근 30일)
Maximilian
Maximilian 2014년 11월 25일
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

답변 (1개)

Subin Kuttappan Stellal Mary
Subin Kuttappan Stellal Mary 2016년 5월 4일
편집: Subin Kuttappan Stellal Mary 2016년 5월 4일
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]);
}
}

카테고리

Help CenterFile Exchange에서 Modeling에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by