PDF de programación - Octave Quick Reference

Imágen de pdf Octave Quick Reference

Octave Quick Referencegráfica de visualizaciones

Publicado el 30 de Abril del 2018
551 visualizaciones desde el 30 de Abril del 2018
86,8 KB
3 paginas
Creado hace 16a (20/12/2007)
Octave Quick Reference Octave Version 3.0.0

Starting Octave
octave
octave file
octave --eval code Evaluate code using Octave
octave --help

start interactive Octave session
run Octave on commands in file

describe command line options

Stopping Octave
quit or exit
INTERRUPT

exit Octave
(e.g. C-c) terminate current command and

return to top-level prompt

Getting Help
help
help command
doc
doc command
lookfor str
Motion in Info
SPC or C-v
DEL or M-v
C-l

list all commands and built-in variables
briefly describe command
use Info to browse Octave manual
search for command in Octave manual
search for command based on str

scroll forward one screenful
scroll backward one screenful
redraw the display

Node Selection in Info
n
p
u
t
d
<
>
g
C-x k
Searching in Info
s
C-s
C-r
i
,

select the next node
select the previous node
select the ‘up’ node
select the ‘top’ node
select the directory node
select the first node in the current file
select the last node in the current file
reads the name of a node and selects it
kills the current node

search for a string
search forward incrementally
search backward incrementally
search index & go to corresponding node
go to next match from last ‘i’ command

Command-Line Cursor Motion
C-b
C-f
C-a
C-e
M-f
M-b
C-l

move back one character
move forward one character
move to the start of the line
move to the end of the line
move forward a word
move backward a word
clear screen, reprinting current line at top

Inserting or Changing Text
M-TAB
DEL
C-d
C-v
C-t
M-t
[ ] surround optional arguments

insert a tab character
delete character to the left of the cursor
delete character under the cursor
add the next character verbatim
transpose characters at the point
transpose words at the point

... show one or more arguments

Killing and Yanking
C-k
C-y
M-d
M-DEL
M-y

kill to the end of the line
yank the most recently killed text
kill to the end of the current word
kill the word behind the cursor
rotate the kill ring and yank the new top

Command Completion and History
TAB
M-?
RET
C-p
C-n
M-<
M->
C-r
C-s
history [-q] [N]

complete a command or variable name
list possible completions
enter the current line
move ‘up’ through the history list
move ‘down’ through the history list
move to the first line in the history
move to the last line in the history
search backward in the history list
search forward in the history list

list N previous history lines, omitting

history -w [file]

history -r [file]

history numbers if -q

write history to file (~/.octave hist if no

file argument)

read history from file (~/.octave hist if

no file argument)

edit history lines edit and then run previous commands

from the history list

run history lines

run previous commands from the history

[beg] [end]

list

Specify the first and last history

commands to edit or run.

If beg is greater than end, reverse the list of commands
before editing. If end is omitted, select commands from
beg to the end of the history list. If both arguments are
omitted, edit the previous item in the history list.

Shell Commands
cd dir
pwd
ls [options]
getenv (string)

change working directory to dir
print working directory

print directory listing
return value of named environment

system (cmd)

execute arbitrary shell command string

variable

Matrices
Square brackets delimit literal matrices. Commas separate
elements on the same row. Semicolons separate rows. Commas
may be replaced by spaces, and semicolons may be replaced by
one or more newlines. Elements of a matrix may be arbitrary
expressions, assuming all the dimensions agree.

[ x, y, ... ]
[ x; y; ... ]
[ w, x; y, z ]

enter a row vector
enter a column vector

enter a 2×2 matrix

Multi-dimensional Arrays
Multi-dimensional arrays may be created with the cat or
reshape commands from two-dimensional sub-matrices.

squeeze (arr)
ndims (arr)
permute (arr, p)
ipermute (arr, p) array inverse permutation.

remove singleton dimensions of the array.
number of dimensions in the array.
permute the dimensions of an array.

shiftdim (arr, s) rotate the array dimensions.
circshift (arr, s) rotate the array elements.

Sparse Matrices
sparse (...)
speye (n)
sprand (n, m, d) sparse rand matrix of density d.
spdiags (...)
nnz (s)

create a sparse matrix.
create sparse identify matrix.

sparse generalization of diag.
No. non-zero elements in sparse matrix.

Ranges
base : limit
base : incr : limit
Specify a range of values beginning with base with no
elements greater than limit. If it is omitted, the default
value of incr is 1. Negative increments are permitted.

Strings and Common Escape Sequences
A string constant consists of a sequence of characters enclosed
in either double-quote or single-quote marks. Strings in double-
quotes allow the use of the escape sequences below.

\\
\"
\’
\n
\t

a literal backslash
a literal double-quote character
a literal single-quote character
newline, ASCII code 10
horizontal tab, ASCII code 9

Index Expressions
var (idx)
var (idx1, idx2)

scalar

vector

range

:

select elements of a vector
select elements of a matrix
select row (column) corresponding to

scalar

select rows (columns) corresponding to the

elements of vector

select rows (columns) corresponding to the

elements of range

select all rows (columns)

Global and Persistent Variables
global var1 ...
Declare variables global.
global var1 = val Declare variable global. Set intial value.
persistent var1
persistent var1 =
val
Global variables may be accessed inside the body of a function
without having to be passed in the function parameter list
provided they are declared global when used.

Declare a variable as static to a function.
Declare a variable as static to a function

and set its initial value.

Selected Built-in Functions
EDITOR
Inf, NaN
NA
PAGER
ans
eps
pi

editor to use with edit history
IEEE infinity, NaN
Missing value
program to use to paginate output
last result not explicitly assigned
machine precision
π

√−1

1i
realmax
realmin

maximum representable value
minimum representable value

Copyright 1996, 1997, 2007 John W. Eaton

Permissions on back

Assignment Expressions
var = expr
var (idx) = expr
var (idx) = []

assign expression to variable
assign expression to indexed variable
delete the indexed elements.
assign elements of a cell array.

var {idx} = expr
Arithmetic and Increment Operators
x + y
x - y
x * y
x .* y
x / y

addition
subtraction
matrix multiplication
element by element multiplication
right division, conceptually equivalent to

x ./ y
x \ y

x .\ y
x ^ y
x .^ y
- x
+ x
x ’
x .’
++ x
(-- x)
x ++ (x --)

(inverse (y’) * x’)’

element by element right division
left division, conceptually equivalent to

inverse (x) * y

element by element left division
power operator
element by element power operator
negation
unary plus (a no-op)
complex conjugate transpose
transpose
increment (decrement), return new value
increment (decrement), return old value

Comparison and Boolean Operators
These operators work on an element-by-element basis. Both
arguments are always evaluated.

true if x is less than y
true if x is less than or equal to y
true if x is equal to y
true if x is greater than or equal to y
true if x is greater than y
true if x is not equal to y
true if both x and y are true
true if at least one of x or y is true
true if bool is false

x < y
x <= y
x == y
x >= y
x > y
x != y
x & y
x | y
! bool
Short-circuit Boolean Operators
Operators evaluate left-to-right. Operands are only evaluated if
necessary, stopping once overall truth value can be determined.
Operands are converted to scalars using the all function.

x && y
x || y

true if both x and y are true
true if at least one of x or y is true

Operator Precedence
Table of Octave operators, in order of increasing precedence.

statement separators
assignment, groups left to right
logical “or” and “and”
element-wise “or” and “and”
relational operators
colon
addition and subtraction

; ,
=
|| &&
| &
< <= == >= > !=
:
+ -
* / \ .* ./ .\ multiplication and division
’ .’
+ - ++ -- !
^ .^

transpose
unary minus, increment, logical “not”
exponentiation

Paths and Packages
path
pathdef
addpath(dir)
EXEC PATH
pkg list
pkg load pack

display the current Octave cunction path.
display the default path.
add a directory to the path.
manipulate the Octave executable path.
display installed packages.
Load an installed package.

Cells and Structures
var.field = ...
var{idx} = ...

cellfun(f, c)
fieldnames(s)
Statements
for identifier = expr stmt-list endfor

set a field of a structure.

set an element of a cell array.
apply a function to elements of cell array.
returns the fields of a structure.

Execute stmt-list once for each column of expr. The variable
identifier is set to the value of the current column during
each iteration.

while (condition) stmt-list endwhile

Execute stmt-list while condition is true.

break
continue
return

exit innermost loop
go to beginning of innermost loop
return to calling function

if (condition) if-body [else else-body] endif

Execute if-body if condition is true, otherwise execute else-
body.

if (condition) if-body [elseif (condition) elseif-body] endif
Execute if-body if condition is true, otherwise execute the
elseif-body corresponding to the first elseif condition that
is true, otherwise execute else-body.
Any number of elseif clauses may appear in an if
statement.

unwind protect body unwind protect cleanup cleanup end

Execute body. Execute cleanup no matter how control exits
body.

try body catch cleanup end

Execute body. Execute cleanup if body fails.

Strings
strcmp (s, t)
strcat (s, t, ...)
regexp (str, pat)
regexprep (str, pat, rep) Match and replace sub-strings

compare strings
concatenate strings
strings matching regular expression

Defining Functions
function [ret-list] function-name [ (arg-list) ]

function-body

endfunction

ret-list may be a single identifier or a comma-separated list of
identifiers delimited by square-brackets.

arg-list is a comma-separated list of identifiers and may be
empty.

Function Hand
  • Links de descarga
http://lwp-l.com/pdf10729

Comentarios de: Octave Quick Reference (0)


No hay comentarios
 

Comentar...

Nombre
Correo (no se visualiza en la web)
Valoración
Comentarios...
CerrarCerrar
CerrarCerrar
Cerrar

Tienes que ser un usuario registrado para poder insertar imágenes, archivos y/o videos.

Puedes registrarte o validarte desde aquí.

Codigo
Negrita
Subrayado
Tachado
Cursiva
Insertar enlace
Imagen externa
Emoticon
Tabular
Centrar
Titulo
Linea
Disminuir
Aumentar
Vista preliminar
sonreir
dientes
lengua
guiño
enfadado
confundido
llorar
avergonzado
sorprendido
triste
sol
estrella
jarra
camara
taza de cafe
email
beso
bombilla
amor
mal
bien
Es necesario revisar y aceptar las políticas de privacidad