Octave – How To


1.  Download and install:
            Windows:Installer available at http://octave.sourceforge.net
            OSX: Ready to run binary available here  http://octave.sourceforge.net
            Linux: There are a number of packages available by distribution. The current ubuntu package       set available in the default repositories is complete. Otherwise, there are a couple of tarballs    here: http://www.gnu.org/software/octave/download.html
(note: if you do use a linux package, you need to make sure that you have “dlmread”, it's in the    forge extensions, but most sources have it)

  1. When octave is installed, you will want to create a directory in your /home folder (or your user folder in windows) to store files that you are using with octave (ex. /home/octave). You will want to store most of the files you are actively using in this folder, so that you will not have to change your working directory.

            (This folder may be created automatically by some installers)

  1. Start octave.  Because it is a command-line program it will open up in a terminal or command window (linux + osx/ windows)
  2. After octave has started, use the command 'chdir' to change the working directory to the octave directory in your home folder.

                        In windows this will look like 'chdir \your\folder\path'
In osx and linux this will look like 'chdir /your/folder/path'

  1. The octave manual may be explored within the terminal by using the command 'octave –help', additionally, you can use '[command] –help' to learn about the syntax and uses of a given command.
  2. Data from the accelerometer is exported in .csv format (comma-separated-value), and by default it is titled as [a string of numbers].csv.  Octave is not able to deal with files of this format titled using only numbers, so you will have to rename it.
  3. M files are octave scripts.  Run .m files by typing the name of the script (without the .m) while working within the directory in which the file is located.
  4. You will have been given 2 .m files (scripts)

The first, 'read_in_file' is a script that reads the exported accelerometer data, plots the x    y and z accelerations, and then plots the resultant of those three accelerations.
The second generates a simple sine function

  1. To use 'read_in_file' you must, in line 2, change file name 'hobo2.txt' to the name of your .csvfile.  Make sure that you are working in the directory in which this file is located.

Note: Because of a quirk in the plotting program, you may have to run 'read_in_file' twice to get graphs.

  1. The script makesin.m is quite simple, and does not need any changes made to it, simply run S while working within the directory
  2. To close plot windows, go back to the command prompt and type 'close', or 'close all'
  3. To exit octave type 'exit' (simply closing the window may cause errors and does not preserve session data)