Most Octave variables are available for you to use for your own purposes; they never change except when your program assigns values to them, and never affect anything except when your program examines them.
A number of variables have special built-in meanings. Some of them,
eps provide useful predefined constant values.
are examined automatically by Octave, so that you can to tell Octave how
to do certain things. There are also two special variables,
PWD, that are set automatically and carry information from
the internal workings of Octave to your program.
This chapter documents the built-in variables of Octave that don't seem to belong anywhere else. Many more of Octave's built-in variables are documented in the chapters that describe functions that use them, or are affected by their values.
This section describes the variables that you can use to customize Octave's behavior.
Normally, preferences are set in the file `~/.octaverc', so that you can customize your environment in the same way each time you use Octave without having to remember and retype all the necessary commands. See section Startup Files for more information.
PS1when it is ready to read a command. Octave allows the prompt to be customized by inserting a number of backslash-escaped special characters that are decoded as follows:
The default value of
"\s:\#> ". To change it, use a
octave:13> PS1 = "\\u@\\H> "
which will result in the prompt `boris@kremvax> ' for the user `boris' logged in on the host `kremvax.kgb.su'. Note that two backslashes are required to enter a backslash into a string. See section String Constants.
PS1at the beginning of each line after the first. Octave allows
PS2to be customized in the same way as
PS1. The default value of
--echo-inputoption, the value of
PS4is printed before each line of input that is echoed. Octave allows
PS4to be customized in the same way as
PS1. The default value of
"+ ". See section Invoking Octave, for a description of
3^2 + 4^2
is evaluated, the value of
ans is `25'.
completion_append_charis used as the character to append to successful command-line completion attempts. The default value is
" "(a single space).
ok_to_lose_imaginary_partis nonzero, implicit conversions of complex numbers to real numbers are allowed (for example, by fsolve). If the value is
"warn", the conversion is allowed, but a warning is printed. Otherwise, an error message is printed and control is returned to the top level. The default value is
print_answer_id_nameis nonzero, variable names are printed along with the result. Otherwise, only the result values are printed. The default value is 1.
propagate_empty_matricesis nonzero, functions like
svdwill return an empty matrix if they are given one as an argument. The default value is 1. See section Empty Matrices.
treat_neg_dim_as_zerois nonzero, expressions like
produce an empty matrix (i.e., row and column dimensions are zero). Otherwise, an error message is printed and control is returned to the top level. The default value is 0.
Here is a summary of all of Octave's preference variables and their
default values. In the following table
OCT_HOME stands for
the root directory where Octave is installed,
for the Octave version number, and
SYS stands for the type of
system for which Octave was compiled (for example,
EDITOR "vi" EXEC_PATH ":$PATH" INFO_FILE "OCT_HOME/info/octave.info" INFO_PROGRAM "OCT_HOME/libexec/octave/VERSION/exec/SYS/info" LOADPATH ".:OCT_HOME/lib/VERSION" PAGER "less", or "more" PS1 "\s:\#> " PS2 "> " PS4 "+ " automatic_replot 0 beep_on_error 0 completion_append_char " " default_return_value  do_fortran_indexing 0 define_all_return_values 0 empty_list_elements_ok "warn" gnuplot_binary "gnuplot" history_file "~/.octave_hist" history_size 1024 ignore_function_time_stamp "system" implicit_str_to_num_ok 0 ok_to_lose_imaginary_part "warn" output_max_field_width 10 output_precision 5 page_screen_output 1 prefer_column_vectors 0 prefer_zero_one_indexing 0 print_answer_id_name 1 print_empty_dimensions 1 resize_on_range_error 1 return_last_computed_value 0 save_precision 17 saving_history 1 silent_functions 0 split_long_rows 1 struct_levels_to_print 2 suppress_verbose_help_message 1 treat_neg_dim_as_zero 0 warn_assign_as_truth_value 1 warn_comma_in_global_decl 1 warn_divide_by_zero 1 warn_function_name_clash 1 whitespace_in_literal_matrix ""
The following variables may be set from the environment or by a command line option.
Variable Environment Variable Option -------- -------------------- ------ EDITOR EDITOR EXEC_PATH OCTAVE_EXEC_PATH --exec-path PATH LOADPATH OCTAVE_PATH --path PATH INFO_FILE OCTAVE_INFO_FILE --info-file FILE INFO_PROGRAM OCTAVE_INFO_PROGRAM --info-program PROGRAM history_size OCTAVE_HISTSIZE history_file OCTAVE_HISTFILE
Go to the first, previous, next, last section, table of contents.