Octave
brew install octave
Command window[edit]
- 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]
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]
- 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]
Open Octave and type dir to verify that no folder called myfiles exists. Then type
mkdir myfiles
Verify that you have created myfiles by typing dir. Then type
pwd
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:
hello
You should see "hello world". Now you can type
quit
Congratulations, you have just run your first batch program!
See also[edit]
datamash
command-line program which performs basic numeric and statistical operationsbc, datamash
, Octave- R, plot, Magicplot, octave
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Source: https://en.wikiversity.org/wiki/MATLAB/Octave
Advertising: