Octave

Innovative

Audio filters, custom playlists, more audio sources. We've got it all!

Lag Free

We've invested in a powerful infrastructure for the most seamless experience possible!

Easy to use

Our commands are simple and easy to use for anyone in your server!

Constant Updates

We are always adding and improving on new features! Competitive is our middle name!

GNU-Octave-enable-64 Archived. Provides the necessary prerequisites to compile GNU Octave using 64-bit indices. Gplv3 makefile octave. Makefile GPL-3.0 7 9 0 0 Updated on Apr 13, 2020. Oct 14, 2015 OCTAVE is a risk assessment methodology to identify, manage and evaluate information security risks. This methodology serves to help an organization to: develop qualitative risk evaluation criteria that describe the organization’s operational risk tolerances. Identify assets that are important to the mission of the organization. Octave is a high-level programming language with the application in mathematics. Its main functions include solving equations and algebra. Moreover, Octave serves as a tool for statistical analysis and numerical experiments.Users also sometimes utilize it for automated processing of information. Octave runs in a graphical user interface, which.

Keeping your experience fresh with innovative features

Octave offers a plethora of features to enhance your listening experience. Audio filters, custom playlists, and a multitude of supported audio sources are just a handful of details that help to offer a refined and unique experience for everyone.

It's easy to get started listening to music with Octave

Unlike other bots, you don't have to run 2-3 commands to start playing a song. It's as simple as joining a voice channel and running the play command with your search query and the bot will automatically join and start playing music. It really can't be any easier.

Add our bots to your server today!

Add Octave for the premium music bot experience, and add Octave Canary for an alpha version of upcoming updates to Octave. Additionally, add both so your server can listen to music in two channels at once!
Add OctaveAdd Octave CanaryGo to the first, previous, next, last section, table of contents.

There are two distinct classes of input and output functions. The firstset are modeled after the functions available in MATLAB. Thesecond set are modeled after the standard I/O library used by the Cprogramming language. The C-style I/O functions offer more flexibilityand control over the output, but are not quite as easy to use as thesimpler MATLAB-style I/O functions.

When running interactively, Octave normally sends any output intendedfor your terminal that is more than one screen long to a paging program,such as less or more. This avoids the problem of havinga large volume of output stream by before you can read it. Withless (and some versions of more) it also allows you toscan forward and backward, and search for specific items.

No output is displayed by the pager until just before Octave is ready toprint the top level prompt, or read from the standard input using thefscanf or scanf functions. This means that there may besome delay before any output appears on your screen if you have askedOctave to perform a significant amount of work with a single commandstatement. The function fflush may be used to force output to besent to the pager immediately. See section C-Style I/O Functions.

You can select the program to run as the pager by setting the variablePAGER, and you can turn paging off by setting the value of thevariable page_screen_output to the string `'false'.See section User Preferences.

Octave apartments

Basic Input and Output

Since Octave normally prints the value of an expression as soon as ithas been evaluated, the simplest of all I/O functions is a simpleexpression. For example, the following expression will display thevalue of pi

This works well as long as it is acceptable to have the name of thevariable (or `ans') printed along with the value. To print thevalue of a variable without printing its name, use the functiondisp. For example, the following expression

will print

Note that the output from disp always ends with a newline.

A simple way to control the output format is with the formatstatement. For example, to print more digits for pi you can use thecommand

Then the expression above will print

Here is a summary of the options for format:

format.
long
Octave will try to print numbers with at least 15 significant figureswithin a field that is a maximum of 24 characters wide.As will the `short' format, Octave will switch to an `e'format if it is unable to format a matrix so that columns line up on thedecimal point and all the numbers fit within the maximum field width.
long e
short e
The same as `format long' or `format short' but always displayoutput with an `e' format. For example, with the `short e'format, pi is displayed as
long E
short E
The same as `format long e' or `format short e' but alwaysdisplay output with an uppercase `E' format. For example, withthe `long E' format, pi is displayed as
free
none
Print output in free format, without trying to line up columns ofmatrices on the decimal point. This also causes complex numbers to beformatted like this `(0.604194, 0.607088)' instead of like this`0.60419 + 0.60709i'.
bank
Print in a fixed format with two places to the right of the decimalpoint.
+
Print a `+' symbol for nonzero matrix elements and a space for zeromatrix elements. This format can be very useful for examining thestructure of a large matrix.

The input function may be used for prompting the user for avalue and storing the result in a variable. For example,

prints the prompt

Octave

and waits for the user to enter a value. The string entered by the useris evaluated as an expression, so it may be a literal constant, avariable name, or any other valid expression.

Currently, input only returns one value, regardless of the numberof values produced by the evaluation of the expression.

Octave definition

If you are only interested in getting a literal string value, you cancall input with the character string `s' as the secondargument. This tells Octave to return the string entered by the userdirectly, without evaluating it first.

Because there may be output waiting to be displayed by the pager, it isa good idea to always call fflush (stdout) before callinginput. This will ensure that all pending output is written tothe screen before your prompt. See section C-Style I/O Functions.

The second input function, keyboard, is normally used for simpledebugging. Using keyboard, it is possible to examine the valuesof variables within a function, and to assign newassign new variablesLike input, it prompts the user for input, but no value isreturned, and it continues to prompt for input until the user types`quit', or `exit'.

If keyboard is invoked without any arguments, a default prompt of`debug> ' is used.

For both of these functions, the normal command line history and editingfunctions are available at the prompt.

To save variables in a file, use the save command. For example,the command

saves the variables `a', `b', and `c' in the file`data'.

The save command can read files in Octave's text and binaryformats as well as MATLAB's binary format. You can specify the defaultformat with the built-in variable default_save_format using one ofthe following values: 'binary' or 'mat-binary'. Theinitial default save format is Octave's text format.

You can use the built-in variable save_precision to specify thenumber of digits to keep when saving data in text format.

The list of variables to save may include wildcard patterns containingthe following special characters:

willmatch all lower and upper case alphabetic characters.

The following options may be specified for save.

default_save_format.
-binary
Save the data in Octave's binary data format. Using this flag overridesthe value of the built-in variable default_save_format.
-float-binary
Save the data in Octave's binary data format but only using singleprecision. Using this flag overrides the value of the built-in variabledefault_save_precision. You should use this format only if youknow that all the values to be saved can be represented in singleprecision.
-mat-binary
Save the data in MATLAB's binary data format. Using this flag overridesthe value of the built-in variable default_save_format.
-save-builtins
Force Octave to save the values of built-in variables too. By default,Octave does not save built-in variables.

Saving global variables also saves the global status of the variable, sothat if it is restored at a later time using `load', it will berestored as a global variable.

To restore the values from a file, use the load command. Forexample, to restore the variables saved in the file `data', use thecommand

Octave will refuse to overwrite existing variables unless you use theoption `-force'.

If a variable that is not marked as global is loaded from a file when aglobal symbol with the same name already exists, it is loaded in theglobal symbol table. Also, if a variable is marked as global in a fileand a local symbol exists, the local symbol is moved to the globalsymbol table and given the value from the file. Since it seems thatboth of these cases are likely to be the result of some sort of error,they will generate warnings.

As with save, you may specify a list of variables and loadwill only extract those variables with names that match.

The load command can read data stored in Octave's text andbinary formats, and MATLAB's binary format. It will automaticallydetect the type of file and do conversion from different floating pointformats (currently only IEEE big and little endian, though other formatsmay added in the future).

The following options may be specified for save.

-binary
Force Octave to assume the file is in Octave's binary format.
-mat-binary
Force Octave to assume the file is in MATLAB's binary format.

C-Style I/O Functions

The C-style input and output functions provide most of the functionalityof the C programming language's standard I/O library. The argumentlists for some of the input functions are slightly different, however,because Octave has no way of passing arguments by reference.

In the following, file refers either to an integer file number(as returned by `fopen') or a file name.

There are three files that are always available:

For example,

opens the file `splat.dat' for reading. Opening a file that isalready open has no effect.

The possible values `mode' may have are

Open a file for reading.
`w'
Open a file for writing. The previous contents are discared.
`a'
Open or create a file for writing at the end of the file.
`r+'
Open an existing file for reading and writing.
`w+'
Open a file for reading or writing. The previous contents arediscared.
`a+'
Open or create a file for reading or writing at the end of thefile.

To close a file once you are finished with it, use the functionfclose (file). If an error is encountered while trying to closethe file, an error message is printed and fclose returns 0.Otherwise, it returns 1.

Formatted Output

This section describes how to call printf and related functions.

The following functions are available for formatted output. They aremodelled after the C language functions of the same name.

sprintf functionreturns the string, automatically sized to hold all of the itemsconverted.

The printf function can be used to print any number of arguments.The template string argument you supply in a call providesinformation not only about the number of additional arguments, but alsoabout their types and what style should be used for printing them.

Ordinary characters in the template string are simply written to theoutput stream as-is, while conversion specifications introduced bya `%' character in the template cause subsequent arguments to beformatted and written to the output stream. For example,

produces output like

This example shows the use of the `%d' conversion to specify that ascalar argument should be printed in decimal notation, the `%s'conversion to specify printing of a string argument, and the `%%'conversion to print a literal `%' character.

There are also conversions for printing an integer argument as anunsigned value in octal, decimal, or hexadecimal radix (`%o',`%u', or `%x', respectively); or as a character value(`%c').

Floating-point numbers can be printed in normal, fixed-point notationusing the `%f' conversion or in exponential notation using the`%e' conversion. The `%g' conversion uses either `%e'or `%f' format, depending on what is more appropriate for themagnitude of the particular number.

You can control formatting more precisely by writing modifiersbetween the `%' and the character that indicates which conversionto apply. These slightly alter the ordinary behavior of the conversion.For example, most conversion specifications permit you to specify aminimum field width and a flag indicating whether you want the resultleft- or right-justified within the field.

The specific flags and modifiers that are permitted and theirinterpretation vary depending on the particular conversion. They're alldescribed in more detail in the following sections.

Output Conversion Syntax

This section provides details about the precise syntax of conversionspecifications that can appear in a printf templatestring.

Characters in the template string that are not part of aconversion specification are printed as-is to the output stream.

The conversion specifications in a printf template string havethe general form:

For example, in the conversion specifier `%-10.8ld', the `-'is a flag, `10' specifies the field width, the precision is`8', the letter `l' is a type modifier, and `d' specifiesthe conversion style. (This particular type specifier says to print anumeric argument in decimal notation, with a minimum of 8 digitsleft-justified in a field at least 10 characters wide.)

In more detail, output conversion specifications consist of aninitial `%' character followed in sequence by:

  • Zero or more flag characters that modify the normal behavior ofthe conversion specification.
  • An optional decimal integer specifying the minimum field width.If the normal conversion produces fewer characters than this, the fieldis padded with spaces to the specified width. This is a minimumvalue; if the normal conversion produces more characters than this, thefield is not truncated. Normally, the output is right-justifiedwithin the field.You can also specify a field width of `*'. This means that thenext argument in the argument list (before the actual value to beprinted) is used as the field width. The value is rounded to thenearest integer. If the value is negative, this means to set the`-' flag (see below) and to use the absolute value as the fieldwidth.
  • An optional precision to specify the number of digits to bewritten for the numeric conversions. If the precision is specified, itconsists of a period (`.') followed optionally by a decimal integer(which defaults to zero if omitted).You can also specify a precision of `*'. This means that the nextargument in the argument list (before the actual value to be printed) isused as the precision. The value must be an integer, and is ignoredif it is negative.
  • An optional type modifier character. This character is ignored byOctave's printf function, but is recognized to providecompatibility with the C language printf.
  • A character that specifies the conversion to be applied.

The exact options that are permitted and how they are interpreted vary between the different conversion specifiers. See the descriptions of theindividual conversions for information about the particular options thatthey use.

Table of Output Conversions

Here is a table summarizing what all the different conversions do:

, `%i'
Print an integer as a signed decimal number. See section Integer Conversions, for details. `%d' and `%i' are synonymous foroutput, but are different when used with scanf for input(see section Table of Input Conversions).
`%o'
Print an integer as an unsigned octal number. See section Integer Conversions, for details.
`%u'
Print an integer as an unsigned decimal number. See section Integer Conversions, for details.
`%x', `%X'
Print an integer as an unsigned hexadecimal number. `%x' useslower-case letters and `%X' uses upper-case. See section Integer Conversions, for details.
`%f'
Print a floating-point number in normal (fixed-point) notation.See section Floating-Point Conversions, for details.
`%e', `%E'
Print a floating-point number in exponential notation. `%e' useslower-case letters and `%E' uses upper-case. See section Floating-Point Conversions, for details.
`%g', `%G'
Print a floating-point number in either normal or exponential notation,whichever is more appropriate for its magnitude. `%g' useslower-case letters and `%G' uses upper-case. See section Floating-Point Conversions, for details.
`%c'
Print a single character. See section Other Output Conversions.
`%s'
Print a string. See section Other Output Conversions.
`%%'
Print a literal `%' character. See section Other Output Conversions.

If the syntax of a conversion specification is invalid, unpredictablethings will happen, so don't do this. If there aren't enough functionarguments provided to supply values for all the conversionspecifications in the template string, or if the arguments are not ofthe correct types, the results are unpredictable. If you supply morearguments than conversion specifications, the extra argument values aresimply ignored; this is sometimes useful.

Integer Conversions

This section describes the options for the `%d', `%i',`%o', `%u', `%x', and `%X' conversionspecifications. These conversions print integers in various formats.

The `%d' and `%i' conversion specifications both print annumeric argument as a signed decimal number; while `%o',`%u', and `%x' print the argument as an unsigned octal,decimal, or hexadecimal number (respectively). The `%X' conversionspecification is just like `%x' except that it uses the characters`ABCDEF' as digits instead of `abcdef'.

The following flags are meaningful:

Left-justify the result in the field (instead of the normalright-justification).
`+'
For the signed `%d' and `%i' conversions, print aplus sign if the value is positive.
` '
For the signed `%d' and `%i' conversions, if the resultdoesn't start with a plus or minus sign, prefix it with a spacecharacter instead. Since the `+' flag ensures that the resultincludes a sign, this flag is ignored if you supply both of them.
`#'
For the `%o' conversion, this forces the leading digit to be`0', as if by increasing the precision. For `%x' or`%X', this prefixes a leading `0x' or `0X' (respectively)to the result. This doesn't do anything useful for the `%d',`%i', or `%u' conversions.
`0'
Pad the field with zeros instead of spaces. The zeros are placed afterany indication of sign or base. This flag is ignored if the `-'flag is also specified, or if a precision is specified.

If a precision is supplied, it specifies the minimum number of digits toappear; leading zeros are produced if necessary. If you don't specify aprecision, the number is printed with as many digits as it needs. Ifyou convert a value of zero with an explicit precision of zero, then nocharacters at all are produced.

Floating-Point Conversions

This section discusses the conversion specifications for floating-pointnumbers: the `%f', `%e', `%E', `%g', and `%G'conversions.

The `%f' conversion prints its argument in fixed-point notation,producing output of the form[-]ddd.ddd,where the number of digits following the decimal point is controlledby the precision you specify.

The `%e' conversion prints its argument in exponential notation,producing output of the form[-]d.ddde[+|-]dd.Again, the number of digits following the decimal point is controlled bythe precision. The exponent always contains at least two digits. The`%E' conversion is similar but the exponent is marked with the letter`E' instead of `e'.

The `%g' and `%G' conversions print the argument in the styleof `%e' or `%E' (respectively) if the exponent would be lessthan -4 or greater than or equal to the precision; otherwise they use the`%f' style. Trailing zeros are removed from the fractional portionof the result and a decimal-point character appears only if it isfollowed by a digit.

The following flags can be used to modify the behavior:

Left-justify the result in the field. Normally the result isright-justified.
`+'
Always include a plus or minus sign in the result.
` '
If the result doesn't start with a plus or minus sign, prefix it with aspace instead. Since the `+' flag ensures that the result includesa sign, this flag is ignored if you supply both of them.
`#'
Specifies that the result should always include a decimal point, evenif no digits follow it. For the `%g' and `%G' conversions,this also forces trailing zeros after the decimal point to be leftin place where they would otherwise be removed.
`0'
Pad the field with zeros instead of spaces; the zeros are placedafter any sign. This flag is ignored if the `-' flag is alsospecified.

The precision specifies how many digits follow the decimal-pointcharacter for the `%f', `%e', and `%E' conversions. Forthese conversions, the default precision is 6. If the precisionis explicitly 0, this suppresses the decimal point characterentirely. For the `%g' and `%G' conversions, the precisionspecifies how many significant digits to print. Significant digits arethe first digit before the decimal point, and all the digits after it.If the precision is 0 or not specified for `%g' or`%G', it is treated like a value of 1. If the value beingprinted cannot be expressed precisely in the specified number of digits,the value is rounded to the nearest number that fits.

Other Output Conversions

This section describes miscellaneous conversions for printf.

The `%c' conversion prints a single character. The `-' flag can be used to specify left-justification in the field, but noother flags are defined, and no precision or type modifier can be given.For example:

prints `hello'.

The `%s' conversion prints a string. The corresponding argumentmust be a string. A precision can be specified to indicate the maximumnumber of characters to write; otherwise characters in the string up tobut not including the terminating null character are written to theoutput stream. The `-' flag can be used to specifyleft-justification in the field, but no other flags or type modifiersare defined for this conversion. For example:

prints ` nowhere '.

Formatted Input

Here are the descriptions of the functions for performing formattedinput.

When a matching failure occurs, scanf returns immediately,leaving the first non-matching character as the next character to beread from the stream, and scanf returns all the items that weresuccessfully converted.

The formatted input functions are not used as frequently as theformatted output functions. Partly, this is because it takes some careto use them properly. Another reason is that it is difficult to recoverfrom a matching error.

Input Conversion Syntax

A scanf template string is a string that contains ordinarymultibyte characters interspersed with conversion specifications thatstart with `%'.

Any whitespace character in the template causes any number of whitespacecharacters in the input stream to be read and discarded. The whitespacecharacters that are matched need not be exactly the same whitespacecharacters that appear in the template string. For example, write` , ' in the template to recognize a comma with optional whitespacebefore and after.

Other characters in the template string that are not part of conversionspecifications must match characters in the input stream exactly; ifthis is not the case, a matching failure occurs.

The conversion specifications in a scanf template stringhave the general form:

In more detail, an input conversion specification consists of an initial`%' character followed in sequence by:

  • An optional flag character`*', which says to ignore the textread for this specification. When scanf finds a conversionspecification that uses this flag, it reads input as directed by therest of the conversion specification, but it discards this input, doesnot use a pointer argument, and does not increment the count ofsuccessful assignments.
  • An optional decimal integer that specifies the maximum fieldwidth. Reading of characters from the input stream stops either whenthis maximum is reached or when a non-matching character is found,whichever happens first. Most conversions discard initial whitespacecharacters (those that don't are explicitly documented), and thesediscarded characters don't count towards the maximum field width.
  • An optional type modifier character. This character is ignored byOctave's scanf function, but is recognized to providecompatibility with the C language scanf.
  • A character that specifies the conversion to be applied.

The exact options that are permitted and how they are interpreted vary between the different conversion specifiers. See the descriptions of theindividual conversions for information about the particular options thatthey allow.

Table of Input Conversions

Here is a table that summarizes the various conversion specifications:

Matches an optionally signed integer written in decimal. See section Numeric Input Conversions.
`%i'
Matches an optionally signed integer in any of the formats that the Clanguage defines for specifying an integer constant. See section Numeric Input Conversions.
`%o'
Matches an unsigned integer written in octal radix.See section Numeric Input Conversions.
`%u'
Matches an unsigned integer written in decimal radix.See section Numeric Input Conversions.
`%x', `%X'
Matches an unsigned integer written in hexadecimal radix.See section Numeric Input Conversions.
`%e', `%f', `%g', `%E', `%G'
Matches an optionally signed floating-point number. See section Numeric Input Conversions.
`%s'
Matches a string containing only non-whitespace characters.See section String Input Conversions.
`%c'
Matches a string of one or more characters; the number of charactersread is controlled by the maximum field width given for the conversion.See section String Input Conversions.
`%%'
This matches a literal `%' character in the input stream. Nocorresponding argument is used.

If the syntax of a conversion specification is invalid, the behavior isundefined. If there aren't enough function arguments provided to supplyaddresses for all the conversion specifications in the template stringsthat perform assignments, or if the arguments are not of the correcttypes, the behavior is also undefined. On the other hand, extraarguments are simply ignored.

Numeric Input Conversions

This section describes the scanf conversions for reading numericvalues.

The `%d' conversion matches an optionally signed integer in decimalradix.

The `%i' conversion matches an optionally signed integer in any ofthe formats that the C language defines for specifying an integerconstant.

For example, any of the strings `10', `0xa', or `012'could be read in as integers under the `%i' conversion. Each ofthese specifies a number with decimal value 10.

The `%o', `%u', and `%x' conversions match unsignedintegers in octal, decimal, and hexadecimal radices, respectively.

The `%X' conversion is identical to the `%x' conversion. Theyboth permit either uppercase or lowercase letters to be used as digits.

Unlike the C language scanf, Octave ignores the `h',`l', and `L' modifiers.

String Input Conversions

This section describes the scanf input conversions for readingstring and character values: `%s' and `%c'.

The `%c' conversion is the simplest: it matches a fixed number ofcharacters, always. The maximum field with says how many characters toread; if you don't specify the maximum, the default is 1. Thisconversion does not skip over initial whitespace characters. It readsprecisely the next n characters, and fails if it cannot get thatmany.

The `%s' conversion matches a string of non-whitespace characters.It skips and discards initial whitespace, but stops when it encountersmore whitespace after having read something.

For example, reading the input:

with the conversion `%10c' produces ' hello, wo', butreading the same input with the conversion `%10s' produces'hello,'.

Binary I/O

Octave has to C-style functions for reading and writing binary data.They are fread and fwrite and are patterned after thestandard C functions with the same names.

Octave Records

, 'schar', 'short','int', 'long', 'float', 'double','uchar', 'ushort', 'uint', or 'ulong'. Thedefault precision is 'uchar'.The fread function returns two values, data, which is thedata read from the file, and count, which is the number ofelements read.
fwrite (file, data, precision)
This function writes data in binary form of type precision to thespecified file, which may be either a file name, or a file numberas returned from fopen.The argument data is a matrix of values that are to be written tothe file. The values are extracted in column-major order.The argument precision is a string specifying the type of data toread and may be one of 'char', 'schar', 'short','int', 'long', 'float', 'double','uchar', 'ushort', 'uint', or 'ulong'. Thedefault precision is 'uchar'.The fwrite function returns the number of elements written.The behavior of fwrite is undefined if the values in dataare too large to fit in the specified precision.

Other I/O Functions

Read `len' characters from a file.

To flush output to a stream, use the function fflush (file).This is useful for ensuring that all pending output makes it to thescreen before some other event occurs. For example, it is always a goodidea to flush the standard output stream before calling input.

Three functions are available for setting and determining the position ofthe file pointer for a given file.

The position of the file pointer (as the number of characters from thebeginning of the file) can be obtained using the the functionftell (file).

To set the file pointer to any location within the file, use thefunction fseek (file, offset, origin). The pointer is placedoffset characters from the origin, which may be one of thepredefined variables SEEK_CUR (current position), SEEK_SET(beginning), or SEEK_END (end of file). If origin isomitted, SEEK_SET is assumed. The offset must be zero, or avalue returned by ftell (in which case origin must beSEEK_SET. See section Predefined Constants.

The function frewind (file) moves the file pointer to thebeginning of a file, returning 1 for success, and 0 if an error wasencountered. It is equivalent to fseek (file, 0, SEEK_SET).

The following example stores the current file position in the variable`marker', moves the pointer to the beginning of the file, readsfour characters, and then returns to the original position.

Octave Macos

The function feof (file) allows you to find out if anend-of-file condition has been encountered for a given file. Note thatit will only return 1 if the end of the file has already beenencountered, not if the next read operation will result in anend-of-file condition.

Similarly, the function ferror (file) allows you to findout if an error condition has been encountered for a given file. Notethat it will only return 1 if an error has already been encountered, notif the next operation will result in an error condition.

Octave Online

The function kbhit may be usd to read a single keystroke from thekeyboard. For example,

Octave Definition

will set x to the next character typed at the keyboard, withoutrequiring a carriage return to be typed.

Finally, it is often useful to know exactly which files have beenopened, and whether they are open for reading, writing, or both. Thecommand freport prints this information for all open files. Forexample,

Go to the first, previous, next, last section, table of contents.