|WARNING: This procedure for downloading Octave and Notepad++ needs to be tested. Please fix the inevitable errors made in constructing this procedure!|
Installing GNU Octave 3.8 (GUI version)[edit | edit source]
As of 9/1/2014 we were unable install the latest version of Octave, which is a 3.8 version with a Matlab-like GUI.
Installing GNU Octave 3.6.4[edit | edit source]
This runs in batch mode, which will at first seem alien to those accustomed to the menu of a GUI. But after a while, typing in the command mode will seem easier. The only drawback is that you need to be confident of your MATLAB coding skills because you won't want to run the code every time you write a new line.
Command window[edit | edit source]
- It is important to learn these commands
(For more information see https://www.gnu.org/software/octave/doc/interpreter/System-Utilities.html)
- help *command* gives help for a command.
- cd *directory* moves into the named directory
- dir shows the contents of the current directory
- cd .. moves up to the parent directory
- mkdir *directory* creates the named directory in the current directory
- rmdir *diretory* removes the named directory
- rename *oldfile* *newfile* renames a file
- copyfile *oldfile* *newfile* changes from the old filename to the new.
- pwd shows the path to the current working directory (useful for knowing how to find the folder using Windows)
- q stops the output (but does not display if one attempts to learn about it using help q)
- path prints out a lot of something and is why you need to learn the q command.
- diary *filename* creates a file with a record of command window statements
- quit quits the program (if you close without using it you get an error message)
Organizing files[edit | edit source]
Here is one procedure for organizing your files
- Make a folder in a convenient place. It can either be your desktop, or if you are using campus computers, a flash drive or the "campus cloud". For our purposes this folder will be called OctaveConvenient. You will install shortcuts to Octave and Notepad++ into OctaveConvenient. You might want to store internet to some of the links already mentioned.
Installing[edit | edit source]
- Install Octave 3.6.4 from http://www.gnu.org/software/octave/ Verify that it works by opening it and typing 2+3 (enter). You should get 5. Then type quit
- Install Notepad++ from http://notepad-plus-plus.org/.
- Make a bookmark to our "textbook" at https://www.gnu.org/software/octave/doc/interpreter/
- Another resource ishttp://en.flossmanuals.net/command-line/gnu-octave/
- If you are using Windows, make a file that we shall call Octave_convenient that will contain
- shortcuts to these programs
- a journal written in either Notepad++ or your favorite word processor
- shortcuts to the files that Octave uses to store files and programs (you will create these later)
- From Octave, use pwd to deduce where Octave resides and put a shortcut to that place in your folder. Use dir to see what folders you have and cd newname where newname is a folder that you will use to store your programs. Write the as newprogram.m files but call them from Octave by typing newname without the .m extension.
First batch program[edit | edit source]
Open Octave and type dir to verify that no folder called myfiles exists. Then type
Verify that you have created myfiles by typing dir. Then type
to find the location myfiles on your computer. Use that information to create a shortcut to myfiles in Octave_convenient.
Open Notepad++ and write the following:
close all; clear all;clc; s='hello world'
Do NOT put a semicolon ; after the last line. Save the code as a hello.m (MATrix Laboratory) file, and save it in your myfiles directory that you see when you type dir from the command window in Octave. Use cd myfiles to go into that folder and verify that hello.m is in your active directory. Now type into your command window:
You should see "hello world". Now you can type
Congratulations, you have just run your first batch program!
Footnotes[edit | edit source]
See also[edit | edit source]
- datamash command-line program which performs basic numeric and statistical operations