Main Content

Array Plot with Apple iOS Devices

Plot vector or array data on an Apple iOS™ device using the Array Plot block in DSP System Toolbox™. To implement this workflow, you must install the Simulink Support Package for Apple iOS devices™.


Apple iOS devices provide a user interface and a set of built-in sensors. These sensors enable you to acquire and integrate real-time data for modeling systems. By using the Array Plot (DSP System Toolbox) block, you can display signals generated during simulation in real-time directly on your iOS device screen.

By displaying the Array Plot on an Apple iOS device screen, you can:

  • Display vector or array data in real-time.

  • View signals without a connection to your development computer.

  • Customize the Array Plot style to suit your app.

This example provides two Simulink models:

  • iosarrayplot: Showcases how the power spectrum estimate is displayed on an Apple iOS device using an Array Plot.


Required Products

  • DSP System Toolbox

  • Simulink Support Package for Apple iOS devices

  • Simulink

Required Hardware

  • iPhone, iPod, or iPad

  • USB cable to connect the device to your development computer

Task 1 - Display Signals on the Development Computer

The Spectrum Estimator block in dspstreamingwelch model estimates the spectrum of a noisy chirp signal, sampled at 44100 Hz. The Array Plot block displays the power spectrum estimate.

1. Open the dspstreamingwelch model on your development computer.

2. Double-click the Array Plot block to open the Array Plot window.

3. On the model editor, click the Run button to see the output of the streaming power spectrum estimate.

Task 2 - Display Signals on Your Apple iOS Device

Display the power spectrum estimate on your Apple iOS device

1. Open the iosarrayplot model.

2. Note how the Simulink Display block has been replaced with a Data Display block from the Apple iOS Support Package. This allows you to view the resolution bandwidth (RBW) on your Apple iOS Device.

3. Click Simulation > Model Configuration Parameters to open Configuration Parameters dialog.

4. Select the Hardware Implementation pane and from the Hardware board parameter list, and confirm it is set to Apple iOS Device.

5. Click Device options and ensure that the device matches your device setting. Click OK.

6. On the model toolbar, click the Deploy to Hardware button to build, download, and run the model on your device. In the current working directory, a folder named "iosarrayplot_ert_rtw" contains all of the model's generated project files.

The app displays the power spectrum estimate on your device.

Task 3 - Customize the Array Plot Style on Your Apple iOS Device

Using the model from Task 2, configure the appearance and style of the Array Plot displayed on your Apple iOS device.

1. Open the iosarrayplot model.

2. Double-click the Array Plot block to open the Scope window.

3. In the Scope menu, click View > Style to open the Style dialog.

3. Set the Figure color to gray.

4. Modify the Axes colors. Set the Axes background color to white. Set the Ticks, labels, and grid colors to gray.

5. Set Line width to 6 and set the Line color to blue.

6. Set Plot type to Stem.

7. Click OK.

8. To see the style changes reflected in the app, you must remove the previous project. In the MATLAB Command Window, run:

rmdir('iosarrayplot_ert_rtw', 's');

9. To update these style changes on the Apple iOS device, you must re-build and download the changes by clicking on the Deploy to Hardware button on the model editor.

The Array Plot in the app reflects the new line and axes properties from the Style dialog box of the Array Plot block.

Other Things to Try

  • Modify the model to display signals from Apple iOS Device sensors.

  • Change the scope style to suit your app.