MatLab is a powerful tool that is used througout various disciplines for data processing and analysis. However, in order to get access to it and all its features, there is a fee associated with it. Depending on the needs of the user, this price can at times be somewhat large. Luckily, an open source alternative known as Octave exists which works just as good in many cases at zero monetary cost. Octave’s syntax is for the most part identical to MatLab making the transition a relatively simple one.
- Text Editor (Emacs)
sudo apt-get install tmux
sudo apt-add-repository ppa:octave/stable
tmux new -s octave-ide
In order to get the layout shown above, the following steps need to be taken
Ctrl+b q 0
Now that the layout is setup, work can finally be done. To start off, initialize Octave in pane 0.
Enter the following snippet in the console window
function res = square(x)
Then call it to make sure it does what is expected
square(2) #Should equal 4
Once satisfied that the code works:
- Switch to pane 2 using
Ctrl+b q 2
- Create a script file
myscript.mwith desired code
1; # Prevents octave from processing file as function file.
- Save the script
Switch to pane 1
Ctrl+b q 1 and try to run the newly created script
octave -W myscript.m
The output should look the same as that in the console window.