Getting Started with Apple iOS Devices
This example shows you how to use Simulink Support Package for Apple iOS Devices to run a Simulink® model on an iPhone, iPod or an iPad.
Simulink Support Package for Apple iOS Devices enables you to create and run Simulink models on the iPhone, iPod and iPad. The support package includes a library of Simulink blocks for using devices' sensors and network interfaces.
In this example you will learn how to create and run a simple Simulink model on an Apple iOS device.
When you have completed this example, try these other examples:
If you are new to Simulink, we recommend completing the Interactive Simulink Tutorial, reading the Getting Started section of the Simulink documentation and running the Simulink Getting Started example.
- iPhone, iPod or iPad
- USB cable to connect the device to your host computer
Task 1 - Review Apple iOSBlock Library
Simulink Support Package for Apple iOS Devices provides blocks that you can use to work with device sensors and network interfaces.
1. Enter slLibraryBrowser at the MATLAB® prompt. This opens the Simulink Library Browser.
2. In the Simulink Library Browser, navigate to Simulink Support Package for Apple iOS Devices.
3. Double-click the Camera block. Review the block mask, which contains a description of the block, Target hardware, Camera location, Image size and Sample time parameter for the Camera block.
Task 2 - Create a Model for Apple iOS Devices
In this task, you will create a simple Simulink model that observes the images captured by the device camera.
1. In MATLAB, select HOME > New > Simulink Model.
2. Drag the Camera block to the model.
3. Double-click the Camera block to open the block mask.
4. In the block mask, select your Apple iOS device from the Target hardware parameter list. Click OK.
5. Drag the Video Display block from Apple iOS Devices library to the model.
6. Connect each output of the Camera block to the corresponding input of the Video Display block.
7. Save your model. A pre-configured model is included for your convenience.
Task 3 - Configure and Run the Model on Apple iOS Devices
In this task, you will configure and run your model on an Apple iOS device.
1. Connect a provisioned Apple iOS device to your computer with a USB cable.
2. If you did not provision the device when you installed the support package, enter targetupdater in the MATLAB Command Window and follow the instructions.
3. In your Simulink model, click Simulation > Model Configuration Parameters to open Configuration Parameters dialog.
4. Select the Hardware Implementation pane and select Apple iOS Device from the Hardware board parameter list. Click OK.
5. In your Simulink model, click the Deploy to Hardware button on the toolbar.
6. An app will be built, downloaded and run on your device. The app will now display the camera image on the device screen.
7. Save your model.
A pre-configured model is included for your convenience.
This example introduced the workflow to:
- Create a Simulink model.
- Configure the model.
- Run the model on an Apple iOS device.
In this example you learned that:
- Simulink Support Package for Apple iOS Devices provides blocks for using Apple iOS devices' built-in hardware.
- You can use the Deploy to Hardware button to run a model on Apple iOS devices.