Octave Configuration
This page will walk you through installing Octave and configuring the Octave/NeXtMidas interface. After completing this tutorial, you will be able to make NeXtMidas commands and talk directly to ICE-PIC cards from Octave. This document assumes that you have followed the guide on setting up the Matlab Option Tree, and that you're using a Red Hat distribution of Linux.
Contents
Octave Overview
Octave is a numerical computing toolkit that is, for the most part, compatible with Matlab. It is licensed under the GNU General Public License (GPL). More information can be found at:
http://www.gnu.org/software/octave/
We have tested to ensure that the Matlab Option Tree also works within the Octave toolkit.
Setting Octave for a Red Hat-based architecture requires installing additional packages, compiling GNU Plot, then compiling Octave.
Dependent Package Setup
Here is how to install the additional packages that are required by Octave:
$ sudo yum install gcc-c++ gcc-gfortran pcre-devel blas-devel lapack-devel readline-devel flex bison texinfo texinfo-tex freetype-devel tetex-dvips tetex-latex fontconfig-devel xdg-utils curl-devel gperf autoconf libjpeg-devel libpng-devel gd-devel mesa-libGLU-devel mesa-libGL-devel
GNU Plot Setup
GNU Plot must be setup before installing Octave, if plotting from Octave is desired. It should be noted that newer versions of GNU Plot are available; however, we found that only 4.6.3 had consistent performance (with Octave). Therefore, we have included it in the Matlab Option Tree tarball. We will now untar, compile and, install it:
$ cd ~/ $ cp $NEXTMATROOT/pkg/gnuplot-4.6.3.tar.gz . $ tar xvzf gnuplot-4.6.3.tar.gz $ cd gnuplot-4.6.3 $ ./configure $ make $ sudo make install
Octave Setup
We will now untar, compile, and install Octave to the directory '/opt/octave/'.
Note: Configuring, making, and installing Octave may take over an hour.
$ cd ~/ $ cp $NEXTMATROOT/pkg/octave-3.2.0.tar.gz . $ tar xvzf octave-3.2.0.tar.gz $ cd octave-3.2.0 $ ./configure --prefix=/opt/octave $ make $ sudo make install
64-Bit Bug Fix
If you're on a 64-bit architecture, there is one bug that we'll need to address: Octave is looking for a file (in the JDK directory) that no longer exists. We can create a symbolic link to fix this issue as follows:
$ cd $JAVAHOME/jre/lib/amd64/ $ ln -sf server client
Octave Configuration
Add Octave to your path
If you wish to launch Octave by simply typing 'octave' as a terminal, you'll need to modify the C-Shell Resource file (.cshrc): we need to add the directory where Octave was installed to your path. We'll be tricky and just 'echo' the necessary line to the end of the .cshrc file.
Note: Every time you run the following command a line will be appended to your .cshrc; thus, make sure to execute the command only once.
$ echo setenv PATH \$\{PATH\}:/opt/octave/bin >> ~/.cshrc
Confirm that the change took:
$ tail -n 2 ~/.cshrc setenv PATH ${PATH}:/opt/octave/bin
Source the script to run with the changes:
$ source ~/.cshrc
Add Matlab Option Tree
In order to use NeXtMidas functions, you need to tell Octave where the Matlab Option Tree files are located. This only has to be done once; it must be done as your regular user, e.g., 'iceman':
$ octave octave> addpath("/opt/ice/pkg/nextmat/mat") octave> savepath octave> exit
Java for Octave Setup
Octave doesn't come with the Java Package installed; therefore, we will need to install it. This only needs to be done once; however, it has to be done as root. It should be noted that the Java 1.2.9 package demonstrated the most consistency in our tests. Therefore, we have provided it in the Matlab Option Tree.
$ sudo /opt/octave/bin/octave octave> setenv("JAVA_HOME", "/opt/ice/pkg/jdk") octave> pkg install /opt/ice/pkg/nextmat/pkg/java-1.2.9.tar.gz octave> exit
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:
$ octave octave> cd /opt/ice/pkg/nextmat/examples octave> ls mat2nxm_example.m nxm2mat_example.m picacq_example.m picplay_example.m
Run the mat2nxm example (which doesn't require a PIC card):
$ octave octave> cd /opt/ice/pkg/nextmat/examples octave> mat2nxm_example octave> exit
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:
$ octave octave> cd /opt/ice/pkg/nextmat/examples octave> 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.