Main Content

FromApp

Receive data from method of app

Add-On Required: This feature requires the Simulink Support Package for Android Devices add-on.

  • FromApp block

Libraries:
Simulink Support Package for Android Devices / Advanced

Description

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 FromAppFcn

  • Data size to 3

  • Data type to int32

The method in the Android app must send a data type that this block can accept.

Note

During simulation with no hardware connected, this block does nothing. For more information, see Block Produces Zeros or Does Nothing in Simulation.

Ports

Output

expand all

The block outputs the data returned by the method specified in the Method name parameter.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32

The block outputs the size of the data returned by the method specified in the Method name parameter.

Data Types: double

Parameters

expand all

Enter the name of method in the Android app.

Select the data type of the elements returned by the method specified in the Method name parameter.

Enter the number of data elements the method returns to the block each time it runs.

Specify how often the block reads the method in the Android app.

Note

Smaller values for Sample time require the processor to complete the same number of instructions in less time, which can cause task overruns.

Version History

Introduced in R2014a