Tom Bella
Department of Mathematics
 

HomeResearchTeachingSoftwareAbout Me 

Octave Windows Installation Guide


This guide is meant to help you install and work with Octave on your Windows machine. (My Windows machine runs XP, so there may be some differences in Vista, etc.) It is not meant to teach you to program in Octave/Matlab syntax, only to get the program downloaded, installed, and learn how/where to edit program files. Tutorials for using Octave/Matlab can be found elsewhere, for instance:



Begin by downloading the Windows installer for the current version of Octave. This can be found at http://octave.sourceforge.net by clicking on "Windows installer (Octave and Octave-Forge)". As of this writing, the current version of Octave was 3.2.2, and a copy of this file is saved here, in case you have trouble getting it from Sourceforge.

So now you have a file on your desktop called Octave-blahblahblah-setup.exe.



Run that program. It brings up a standard installer window.



Click Next a few times and you'll come to this window asking you which components you'd like to install.



For our purposes, you won't need any of these packages, so you can just click Next. To install packages, simply check them. (There may be some other steps later if you do, however, I didn't install any packages so I don't know. You're on your own there.)

Once you click next, it'll install some files.



A lot of files, actually. It took my older PC a minute or so to get through this part.



Once the bar finishes, a blank DOS window may pop up, remain blank for a few seconds, then flash something about an error and disappear. This doesn't seem to cause any problems, although it mentions "pkg", the package manager, so if you tried to install some packages, this may be a problem for you.



Then the installer will tell you it's done. I unchecked the box to see the readme file, but go ahead and read it if you like.



The installer will have put an icon on your desktop that loads up Octave. go ahead and click it.



This loads Octave in a DOS window. If you see something like "octave-3.2.2.exe:1:C:\Octave\3.2.2_gcc-4.3.0\bin" followed by a command prompt, Octave is running properly!



So you know, the first part of the prompt is the name of the executable that is running, octave-3.2.2.exe; the 1 between the colons is the equation counter, and will increment as you type commands; and the last part is the working directory, the location that Octave will look for programs you want to run.

The rest of this guide will show you how to create programs, or m-files, and show you where to put them so you can run them from Octave. First, through "My Computer" or otherwise, load a window in the root directory of your Windows primary drive. This is where Octave puts its files by default. You'll see an Octave folder there.





Entering the Octave folder, you'll see that Octave lives in a subfolder called "3.2.2_gcc-4.3.0". Inside that folder, Octave by default loads in the "bin" folder (short for binary, a Linux/UNIX customary location for program files). You're generally better off to put your m-files somewhere else, as the bin directory is a bit crowded.





Let's create a folder called "mfiles" where we can put the program files we write/want to run.





As a test, we create an m-file called "helloworld.m" in this new folder.



When you try to change the extension from ".txt" to ".m" in Windows, you may have to tell Windows that you know what you're doing. (If you have trouble running programs later in this guide, it may actually be with this step. Sometimes Windows doesn't let you change the extension. That is, even though it says "helloworld.m", Windows added a ".txt" to it, so the file is really called "helloworld.m.txt". To fix this problem, there is a setting (varying by Windows version) that you need to change to allow you to change extensions.)



Then open the file by editting it. Trying to open it may not work, or you may have to specify that you want to open it in a text editor, like Notepad, as Windows doesn't know what an m-file is. (If you noticed the icon changed on my image, that's the Matlab logo, since I have Matlab installed on my computer, Windows does know what an m-file is.)



Type some sample program in. I've entered a simple Hello World program.



Next we'll try to run this program. First, we need to tell Octave where the programs we want to run are located. Octave is currently looking in "bin"; to make it look in "mfiles", we type the command

cd ../mfiles

Notice how Octave's command prompt now has "mfiles" in it instead of "bin". You will likely have to run this command each time you load Octave.



Now that we're in the right folder, type the mfile name to run it.



Writing more complicated programs, including multiple outputs such as



can be written and run in the same manner.





So now Octave is running, and you know where to put mfiles to run them. This guide is complete. To continue learning about USING Octave, try one of the guides listed above. Good luck!


 


Copyright © 1999-2017 Tom Bella, Jr. All Rights Reserved.
. .
http://www.math.uri.edu/~tombella     http://www.math.uconn.edu/~bella     [http://www.tombella.com]