Difference between revisions of "Octave"

From wikieduonline
Jump to navigation Jump to search
(Created page with "__TOC__ {{under construction|'''WARNING:''' This procedure for downloading Octave and Notepad++ needs to be tested. Please fix the inevitable errors made in constructing this...")
 
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
__TOC__
+
[[wikipedia:Octave]]
{{under construction|'''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)==
 
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==
 
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===
+
[[brew install octave]]
 +
 
 +
=== Command window ===
 
* It is important to learn these commands
 
* It is important to learn these commands
 
(For more information see https://www.gnu.org/software/octave/doc/interpreter/System-Utilities.html)
 
(For more information see https://www.gnu.org/software/octave/doc/interpreter/System-Utilities.html)
Line 26: Line 23:
 
===Organizing files===
 
===Organizing files===
 
Here is one procedure for organizing your files
 
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 '''[[MATLAB#Links|links]]''' already mentioned.
+
# 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 '''[[MATLAB#Links|links]]''' already mentioned.
  
 
===Installing===
 
===Installing===
Line 62: Line 59:
 
  quit
 
  quit
 
Congratulations, you have just run your first batch program!
 
Congratulations, you have just run your first batch program!
 
 
  
 
==See also==
 
==See also==
 
* <code>[[datamash]]</code> command-line program which performs basic numeric and statistical operations
 
* <code>[[datamash]]</code> command-line program which performs basic numeric and statistical operations
 +
* {{bc}}
 +
* {{R}}
  
 
{{CC license}}
 
{{CC license}}
 
Source: https://en.wikiversity.org/wiki/MATLAB/Octave
 
Source: https://en.wikiversity.org/wiki/MATLAB/Octave
 +
 +
 +
[[Category:computing]]

Latest revision as of 14:04, 6 April 2024

wikipedia: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)

  1. help *command* gives help for a command.
  2. cd *directory* moves into the named directory
  3. dir shows the contents of the current directory
  4. cd .. moves up to the parent directory
  5. mkdir *directory* creates the named directory in the current directory
  6. rmdir *diretory* removes the named directory
  7. rename *oldfile* *newfile* renames a file
  8. copyfile *oldfile* *newfile* changes from the old filename to the new.
  9. pwd shows the path to the current working directory (useful for knowing how to find the folder using Windows)
  10. q stops the output (but does not display if one attempts to learn about it using help q)
  11. path prints out a lot of something and is why you need to learn the q command.
  12. diary *filename* creates a file with a record of command window statements
  13. 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

  1. 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]

  1. 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
  2. Install Notepad++ from http://notepad-plus-plus.org/.
  3. Make a bookmark to our "textbook" at https://www.gnu.org/software/octave/doc/interpreter/
    1. Another resource ishttp://en.flossmanuals.net/command-line/gnu-octave/
  4. If you are using Windows, make a file that we shall call Octave_convenient that will contain
    1. shortcuts to these programs
    2. a journal written in either Notepad++ or your favorite word processor
    3. shortcuts to the files that Octave uses to store files and programs (you will create these later)
  5. 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]

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: