Running Octave and Scilab

About Octave and Scilab - Neither application is a direct substitution for MATLAB. Both these programs are great if you are developing your own code. However, you must be willing to make adjustments to some of the textbook code if you run it in these applications. They are very powerful substitutes, but they are not direct equivalents to MATLAB. If you are uncomforable using MATLAB, I would discourage you from taking on the extra work of understaning these applications and the differences between these programs and MATLAB.

Octave web site.        Scilab web site.

Between these programs, Octave is the most compatible with MATLAB files and the majority of files will run without modification (other than those using a user GUI or nested functions). Octave is a native linux application, not Windows. It can run in Windows using a couple of approaches: (1) Install a virtual machine (e.g. https://www.virtualbox.org/) and a complete linux installation. Then install Octave. It is possible to run both Windows and Linux simulataneously and switch back and forth using virtualbox.; or (2) Install a linux emulator.

Installing a virtual box and linux operating system are beyond the scope of this page. Directions are available on the vitualbox web site. Also, you may need to enable vitual operating systems in your system BIOS.

Most students who want to try Octave should use Cygwin. This option is less work than installing a virtual machine. Note that Linux is a very stable and excellent operating system. Most supercomputer centers run Linux as well as most university networks. The Android phone operating system is a Linux system. However, you do not need to learn much Linux to use Octave.

Installation notes (as of 1/2015) for Octave in Cygwin. Download cygwin from https://www.cygwin.com/. Run the setup. When you install, you will be prompted for what packages to install in the emulator. Keep the setup file because you can use it to make modifications and updates to your package installations. During Cygwin installation, you will want to browse the MATH folder for Octave. There are a lot of Octave-Forge modules listed that are extensions (similar to the MATLAB toolboxes) that are not necessary for most basic coding. You will also want to install some other utilities (X11>Xinit, Xlaunch, and Xterm) and (GRAPHICS>ghostwriter, and gnuplot). As you step through the dialog boxes, all the apps and their dependencies will download/install.

cygwin-octave selection

cygwin-octave-x11a

cygwin-octave-x11b

cygwin-octave-graphics

To run Octave under Cygwin, find in your start menu Cygwin>XLaunch. Select 'Multiple Windows', select 'Start a program', then specify 'xterm', click through to open a terminal window. You are now emulating linux in windows. Type (without quotes) 'export LIBGL_ALWAYS_INDIRECT'. If the fonts are too small, select VTFonts from the menu and change size (hold down mouse until selection is complete). Then enter at the prompt 'octave --force-gui &'. If you omit the '&' , you will not be able to type any other Linux commands in the xterm window until Octave is closed. Ocatave will open in a GUI similar to MATLAB. Be aware that the GUI is still in development and some features may not work, and that the GUI debugger is still in development. Debugging with command prompts or inserting a keyboard() line in the code is suggested. Initially, you will not be able to find windows file system by browsing in the Octave GUI, but it is available. On my installation, my document folder can be found by typing (the first foward slash is important) /cygdrive/c/Users/<username>/Documents/<path to files>. After you reach the 'c', you can start browsing! Be sure to double click when selecting the active folder, because opening a folder using the + does not make the open folder the working directory!

Octave will give non-fatal warnings on some MATLAB code lines used in the textbook software. Some examples I have noticed include lines that use '|' for an 'or' command. Another limitation is that Octave does NOT support nested functions, so you will need to edit such code and pass variables that must share scope.

Scilab - Scilab offers a more advanced GUI as of 1/2015, but also does not currently offer a GUI for debugging. Scilab uses a '.sci' extension for files. You must run mfile2sci('myfile.m') to convert myfile.m to a .sci file. The process will also create a .cat file and some temporary files that can be deleted. See mfile2sci documentation. In my use, I found the conversion rather clumsy for statements using element-by-element operators or even matrix/vector addition/subtraction. Thus more manual correction is needed than with Octave. Also, to use a Scilab function from a file, you must compile it before using it. You need to run exec('myfile.m') before using a function call from the command window or another function. Otherwise the function is not known. When you modify a function, you must recomple. A more serious limitation for running the textbook software is that Scilab currently does not search paths, so code using the MATLAB 'addpath' command must be edited to use the exact paths and a 'cd' must be used in the code to change directory before using files in other directories.

Please use the 'Contact Us' tab above if this page needs revision.