Receive data from method of app
Simulink Support Package for Android Devices / Advanced
Use the FromApp block to receive data from a method in an Android® app. After code generation is completed, you can modify the generated code to configure the Method name, Data type, and Data size (N) parameters to match those of the method.
For example, consider a method,
public int FromAppFcn(), that sends
three data elements each time it runs, and the data type of those elements is
int32. In this case, set these parameter values.
Method name to
Data size to
Data type to
The method in the Android app must send a data type that this block can accept.
During simulation with no hardware connected, this block does nothing. For more information, see Block Produces Zeros or Does Nothing in Simulation.
Data — Data returned by method
The block outputs the data returned by the method specified in the Method name parameter.
Size — Size of data returned by method
The block outputs the size of the data returned by the method specified in the Method name parameter.
Method name — Name of method
'FromAppMethod' (default) | character array
Enter the name of method in the Android app.
Return type — Data type element returned by method
uint8 (default) |
Select the data type of the elements returned by the method specified in the Method name parameter.
Data size (N) — Number of data elements returned by method
32 (default) |
Enter the number of data elements the method returns to the block each time it runs.
Sample time — Time interval of sampling
0.1 (default) | nonnegative scalar
Specify how often the block reads the method in the Android app.
Smaller values for Sample time require the processor to complete the same number of instructions in less time, which can cause task overruns.
Introduced in R2014a