Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
GNU Octave Beginner's Guide

You're reading from   GNU Octave Beginner's Guide Become a proficient Octave user by learning this high-level scientific numerical tool from the ground up

Arrow left icon
Product type Paperback
Published in Jun 2011
Publisher Packt
ISBN-13 9781849513326
Length 280 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Jesper Schmidt Hansen Jesper Schmidt Hansen
Author Profile Icon Jesper Schmidt Hansen
Jesper Schmidt Hansen
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

GNU Octave
Credits
About the Author
About the Reviewers
1. www.PacktPub.com
2. Preface
1. Introducing GNU Octave FREE CHAPTER 2. Interacting with Octave: Variables and Operators 3. Working with Octave: Functions and Plotting 4. Rationalizing: Octave Scripts 5. Extensions: Write Your Own Octave Functions 6. Making Your Own Package: A Poisson Equation Solver 7. More Examples: Data Analysis 8. Need for Speed: Optimization and Dynamically Linked Functions Pop quiz - Answers

Time for action - installing additional packages


  1. 1. Before installing a new package, you should check which packages exist already and what their version numbers are. Start Octave, if you have not done so. Type the following:

octave:1> pkg list
  1. 2. You should now see a table with package names, version numbers, and installation directories. For example:

    Package Name | Version | Installation directory --------------------+-----------+------------------------------------ combinatorics | 1.0.6 | /octave/packages/combinatorics-1.0.6

  2. 3. If you have chosen to install all packages in your Windows installation, the list is long. Scroll down and see if the msh package is installed already, and if so, what the version number is. Again, you can press the Q key to return to the prompt.

  3. 4. Now go to the Octave-Forge web page, find the msh package, and click on Details (to the right of the package name). You will now see a window with the package description, as shown in the following figure. Is the package version number higher than the one already installed? (If not, sit back, relax, and read the following just for the fun of it.) The package description also shows that the msh package dependents on the spline package and Octave version higher than 3.0.0. Naturally, you need Octave. However, the spline package may not be installed on your system. Did you see the spline package when you typed pkg list previously? If not, we will need to install this before installing msh. Go back to the main package list and download the msh and the spline packages to your Octave home directory. (By the way, does the spline package have any dependencies?) The downloaded files will be archived and compressed and have extensions .tar.gz. To install the packages, make sure you are in your Octave home directory and type the following:

octave:2> pkg install splines-version-number.tar.gz
  • (If you need it.)

octave:3> pkg install msh-version-number.tar.gz
  1. 5. Make sure that you have downloaded the package files into the Octave home directory.

  2. 6. To check your new package list, type the following:

octave:4> pkg list
  • Package Name | Version | Installation directory ---------------------+------------+----------------------------- combinatorics | 1.0.6 | /octave/packages/combinatorics-1.0.6 msh | 1.0.1 | /home/jesper/octave/msh-1.0.1 splines * | 1.0.7 | /home/jesper/octave/splines-1.0.7

  1. 7. You can get a description of the msh package by typing the following:

octave5:> pkg describe msh
---
Package name:
msh
Short description:
Create and manage triangular and tetrahedral meshes for Finite
Element or Finite Volume PDE solvers. Use a mesh data structure
compatible with PDEtool. Rely on gmsh for unstructured mesh
generation.
Status:
Not loaded
  1. 8. From the status, you can see that the package has not been loaded, which means we cannot use the functionality that comes with the package. To load it, simply type the following:

octave:6> pkg load msh
  1. 9. You should check that it actually has been loaded using pkg describe msh. Naturally, you can also unload the msh package by using the following command:

octave:7> pkg unload msh

Note

If you are using a multi-user system, consult your system administrator before you install your own local packages.

What just happened?

The important points have already been explained in detail. Note that you need to install splines before msh because of the dependencies.

You may find it a bit strange that you must first load the package into Octave in order to use it. The package can load automatically if you install it with the auto option. For example, command 3 can be replaced with the following:

octave:3> pkg install auto msh-version-number.tar.gz

Some packages will automatically load even though you do not explicitly instruct it to do so when you install it. You can force packages not to load using noauto.

octave:3> pkg install noauto msh-version-number.tar.gz

Uninstalling a package

Unistalling a package is just as easy:

octave:8> pkg uninstall msh

Note that you will get an error message if you try to uninstall splines before msh because msh depends on splines.

You have been reading a chapter from
GNU Octave Beginner's Guide
Published in: Jun 2011
Publisher: Packt
ISBN-13: 9781849513326
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at AU $24.99/month. Cancel anytime