Matlab Configuration

From ICE Enterprises
Jump to navigation Jump to search

This page will walk you through configuring the Matlab/NeXtMidas interface. After completing this tutorial, you will be able to make NeXtMidas commands and talk directly to ICE-PIC cards from Matlab. This document assumes that you have followed the guide on setting up the Matlab Option Tree, that you have Matlab installed, and that you're using a Red Hat distribution of Linux.

Matlab Configuration

Since we have already setup the NeXtMidas environment in this tutorial, we simply need to tell Matlab where the Matlab Option Tree scripts are located. By default, they are located in the directory:

/opt/ice/pkg/nextmat/mat/

Therefore, we need to add '/opt/ice/pkg/nextmat/mat/' to the Matlab path. We can do this permanently with the following steps:

  1. Click on the 'HOME' tab
  2. Click 'Set Path'
  3. Click 'Add Folder'
  4. Navigate to the 'mat' folder in the NeXtMidas Matlab Option tree (i.e. /opt/ice/pkg/nextmat/mat/)
  5. Click 'OK'
  6. Click 'Save'
  7. Click 'Close'

Note: These instructions were derived using Matlab R2013b (8.2.0.701). The procedure to add a path may be slightly different in other versions.

Running Example Scripts

We have provided some scripts in the 'examples' directory of the Matlab Option Tree. Let's enter the examples directory and look at the files:

>> cd /opt/ice/pkg/nextmat/examples
>> ls
mat2nxm_example.m  nxm2mat_example.m  picacq_example.m  picplay_example.m

Run the mat2nxm example (which doesn't require a PIC card):

>> cd /opt/ice/pkg/nextmat/examples
>> mat2nxm_example

If you have a PIC card installed, you may wish to run one of the PIC examples. Note that the picacq and picplay examples might not work out of the box: you might have to change the PIC card and module ports to reflect your setup. The picacq example assumes that there is a module capable of acquisition on 'module1' of 'pic1'. The picplay example assumes that there is a module capable of playback on 'module2' of 'pic1'. Let's launch the playback example:

>> cd /opt/ice/pkg/nextmat/examples
>> picplay_example

You will now see the 'snapapp' GUI appear. To start playback, click the 'RTPlayback' button. You should see two tones: one at 2.5 MHz and one at 4.75 MHz. To stop playback hit the 'Exit' button.