This example shows you how to use Simulink Support Package for Samsung GALAXY Android Devices to run a Simulink® model on a Samsung GALAXY S4 or Samsung GALAXY Tab 2 10.1.
Simulink Support Package for Samsung GALAXY Android Devices enables you to create and run Simulink models on the Samsung GALAXY S4 and Tab 2 10.1. The support package includes a library of Simulink blocks for using Samsung GALAXY sensors and network interfaces.
In this example you will learn how to create and run a simple Simulink model on a Samsung GALAXY Android device.
When you have completed this example, try these other examples:
Communicating with Samsung GALAXY Android Devices: Use External mode to monitor and fine-tune an application using real sensor data on the Android device.
Sensor Application: Design an algorithm and create a user interface for interacting with it.
If you are new to Simulink, we recommend completing the Interactive Simulink TutorialInteractive Simulink Tutorial, reading the Getting Started section of the Simulink documentationSimulink documentation and running the Simulink Getting Started exampleSimulink Getting Started example.
You will need the following hardware:
Samsung GALAXY S4 or Samsung GALAXY Tab 2 10.1
USB cable to connect the device to host computer
Task 1 - Review Samsung GALAXY Android Block Library
Simulink Support Package for Samsung GALAXY Android Devices provides blocks that you can use to work with device sensors and network interfaces.
2. In the Simulink Library Browser, navigate to Simulink Support Package for Samsung GALAXY Android Devices.
3. Double-click the Accelerometer block. Review the block mask, which contains a description of the block and a sample time parameter for the Accelerometer sensor.
Task 2 - Create a Model for Samsung GALAXY Android Devices
In this task, you will create a simple Simulink model that observes the output of accelerometer.
1. In MATLAB, select HOME > New > Simulink Model.
2. Drag the Accelerometer block to the model. Use the default settings for the block.
3. Open Simulink/Sinks library and drag the Display block to the model.
4. Connect the Accelerometer block to the Display block.
Task 3 - Configure and Run the Model on Samsung GALAXY Android Devices
In this task, you will configure and run your model on a Samsung GALAXY Android device like S4.
1. Connect a Samsung GALAXY S4 to your computer with a USB cable.
2. If you did not enable USB debugging on the device when you installed the support package, enter
targetupdater in the MATLAB Command Window, follow the instructions to update the device settings.
4. In your Simulink model, click Tools > Run on Target Hardware > Prepare To Run.
5. In the Configuration Parameters, set the Target hardware parameter to Samsung GALAXY S4. Do not change any other settings.
6. Click OK.
7. In your Simulink model, click the Deploy to Hardware button on the toolbar. Simulink builds an app from the model. Then it downloads and runs the app on your device.
8. On the device, observe that the app displays a default screen that says "Hello world, <model name>".
9. Save your model.
This example introduced the workflow for creating a Simulink model, configuring the model, and then running it on a Samsung GALAXY Android device. In this example you learned that:
Simulink Support Package for Samsung GALAXY Android Devices provides blocks for using Samsung GALAXY devices' built-in sensors.
You can use the Deploy to Hardware button to run a model on Samsung GALAXY Android devices.