Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Customizing Octave

I am just starting with Octave and running it on my terminal so far.

Everytime I open the prompt, my command line starts with :

octave-3.4.0:1> 

So I use the following to make it shorter and easier to read:

PS1('>> ')

How can I change my settings to exectute this code automatically everytime I open octave?

How top of this, is there a way to change my terminal settings to open Octave when I enter 'Octave'? The way I do it now is by using

'exec 'path/to/octave/

Thanks

like image 514
Spearfisher Avatar asked May 30 '14 15:05

Spearfisher


People also ask

How do I change layout in octave?

In the main octave window there should be a "Reset Default Window Layout" menu item under the Window menu. That should restore everything to the default layout without having to go to the trouble of a full reinstall.

Where is Octaverc?

octaverc file is the octave configuration file on Linux that resides in the user's home directory (~). It has basically the same role as startup.


1 Answers

You can create edit ~/.octaverc file that contains all the commands you want to execute when Octave starts up. This file is exactly like a .m Octave script file.

Just add PS1('>> ') to your ~/.octaverc file. You can use your favorite text editor or use echo on the command line:

$ echo "PS1('>> ')" >> ~/.octaverc

After that you can see the ~/.octaverc file :

$ more ~/.octaverc

It should contain the following line :

PS1('>> ')

For the second question, I am not sure if you're on OSX or Ubuntu or something else. If octave is in your search-path then you should be able to start Octave by just trying octave. Try these commands to find out what octave points to

$ which octave
/usr/bin/octave

$ type octave
octave is /usr/bin/octave

If somehow, octave is not your PATH search-path, this could be because you installed Octave at a non-standard location. You can do one of two things:

  1. Add the folder containing your Octave executable to your PATH search-path. In bash, you can do this by adding the following line to your ~/.bashrc (or ~/.profile on MacOSX):

      export PATH=~/path/to/octave/folder:${PATH}
    
  2. You can create a soft symlink to your octave executable.

    ln -s /path/to/octave/executable octave
    

This will create a symlink in your current folder. Now, as long as you're in the current folder, you'll be able to type in octave and run Octave. If you want to be able to run Octave from anywhere (and not necessarily the current folder), you need to add the current folder to your search-path (see point 1 above).

like image 177
Ankur Avatar answered Sep 23 '22 06:09

Ankur