Home > Preview
The flashcards below were created by user
sstringer
on FreezingBlue Flashcards.

who
Shows variables that have been defined in this Command Window (just shows the names of the variables).

whos
Shows variables that have been defined in this Command Window (this shows more information on the variables, similar to what is in the Workspace Window).

clear
Clears out all variables so they no longer exist.

clear variablenames
Clears out a particular variable.

abs(variable)
Absolute value of that number or variable.

fix(variable)
Round towards zero.

floor(variable)
Round towards minus infinity.

ceil(variable)
Round towards positive infinity.

round(variable)
Round to nearest integer.

sign(variable)
Returns 1 if number greater than zero; returns 0 if it is zero; returns 1 if less than zero.

rem(num,div)
Returns the remainder from division (first number divided by the second number).

char, logical, int32, double
char = used to store single characters or strings; logical = used to store true/false values; int32 = integer with max 32 bits; double = real number, can use floating point.

rand
Generates a random real number from 01.

How to generate a random integer in the range of xy.
round(rand*(yx))x

How to create a row vector or column vector
 Row vec: v = [1 2 3 4] or [1:4]; for steps, use colon operator.
 Column vec: v = [1;2;3;4]

How to refer to an element in (a) a vector (b) a matrix?
 a) myvec(element#)
 b) mymat(row#,column#)  can refer to subsets of matrices (ex: mymat(1:2,2:3)). If a single index is used (ex: mymat(1)), it unwinds the matrix columnwise (goes down row by row until the next column).

How to create a matrix.
mat = [4 3 1; 2 5 6; 3:5]

zeros(rows, columns) ; zeros(#)
ones(rows, columns); ones(#)
Creates a matrix of zeroes (or ones) of the given dimensions; if only one number is given, that will be the number of rows and columns.

length(variable)
Gives the number of elements in a vector and the length of the largest dimension (either rows or columns) in a matrix.

size(variable)
Returns the numbers of rows and columns in a matrix (rows first, then columns).

numel(variable)
Returns the total number of elements in an array (vector or matrix).

variable(end,#)
end refers to the last element in a vector. vec(end) = vec(length(vec)). In a matrix, it can refer to the last element in a row or column. Ex: mymat(end,1) returns the last element of the first row and first column.

reshape(variable,rows,columns)
Iterates through the matrix columnwise and returns a new matrix with the new dimensions.

fliplr(variable)
Flips the matrix from left to right; the leftmost column becomes the last column and so forth.

flipud(variable)
Flips up to down. Works from outsides in. (1st becomes last, 2nd becomes 2nd to last, etc.)

rot90(variable)
Rotates the matrix counterclockwise 90 degrees. The topright value becomes the topleft value; last column becomes the first row.

rep
mat(variable,m,n)
Creates a larger matrix, which consists of an m x n matrix of copies of the matrix named in the function call. Ex: a 2 x 2 matrix when called in repmat(mat,2,3) becomes a 6 x 4 matrix with repetitions of the original 2 x 2.

Empty vector
[ ]; a vector that stores no values, created using empty brackets.

script
A simple computer program in MATLAB, saved as a .m file. To run a script, simply enter the name of the file without the .m extension.

type
displays the content of a script. Format: type scriptfilename *scriptname without the .m extension.

lookfor
searches for the H1 line of a function to describe what it does.

input
 used in an assignment statement, to allow the user to input a value to a variable. Format: variable = input('String to prompt the user: ');. If the input will be a string, add 's' at the end to specify that. Normally the results are suppressed with a semicolon at the end of the assignment statement.
 If a string input hasn't been specified but the user enters a number, will error. The user must either enter it as a string, or it should be specified in the program that the user will be entering a string.
 Need separate input statements for each variable assigned.
 The only formatting allowed in input is the newline character.

disp
output function, displays the result of an expression or a string without assigning any value to a variable (either a given variable or the default variable ans). disp doesn't allow for formatting, it just does what's in the argument. Ex: disp(6*4) will display 24. Will display matrices or vectors as they are, not unwinding them.

fprintf
 Displays output and allows for formatting. First you pass a string that will be displayed, inserting placeholders where values will go, and then follow with any variables to be printed.
 %d = integers
 %f = floats
 %c = single characters
 % s = strings
 \n = newline character, will move down to the next line.
 Can specify fieldwidth for formatting as well. If it's a vector, only need one placeholder. Unwinds matrices columnwise.

plot
 Plots simple 2d points and either connects them with lines or plots them as individual points. Can format them with strings such as 'r*' (red star) after the x and y vectors have been called in the argument: plot(x,y,'format').
 To plot more than one point, need to do it in x and y vectors.
 When x values are indices of the y vector (ex: when x represents time from 1:n), then you can simply plot the y function (plot(y)) and it does the same thing.
 help plot will display ways to format.

xlabel
Uses a string as the argument to create a label for the x axis: xlabel('Time')

ylabel
Uses a string argument to create a label for the yaxis: Ex: ylabel('Temperature')

title
Uses a string argument to create a title for the graph. Ex: title('Time and Temp')

axis
One vector is passed when calling the axis function. The first two values are the min and max for the xaxis, the second are the min and max for the y. Ex: axis([1 10 3 8]). Can also customize it to graph: axis([x2 x+2 y2 y+2])

clf
Clears the Figure Window by removing everything from it. Doesn't take any input or output.

figure
Creates a new, empty Figure Window when called without any arguments. Calling figure(n) where n is an integer can create and maintain multiple Figure Windows; allows to refer to each individually.

hold
A toggle function; hold on (or just hold) means you freeze the current graph in the Figure Window to superimpose another. hold off will unfreeze it. Or, just by saying hold a second time, it lets go.

legend
Displays strings passed to it in a legend box in the Figure Window, in order of the plots in the Figure Window. Ex: plotting two y vectors, can create a legend('y1', 'y2').

grid
Another toggle function, will display gridlines or not. Especially good for 3D graphs. Grid on/grid off or just call it once (on) or twice (off).

bar
bar(xvec,yvec) creates a bar chart.

load
to read files. Use load filename.dat. Can type who to see what was loaded (loads variables into workspace). It only works with matrices, though, so only if there are the same number of values in each line.

save
used to write data or to append. Format: save filename matrixvariablename ascii. The matrixvariablename is what your variable name is that you want to store. The filename is what you will store it as. Stores it as a .dat file with the ascii. If you want to add more to a file (append it), put append after ascii. Will only save variables that are scalars, vectors, or matrices; must be of uniform length.

Calling a function
The name of the function, followed by the arguments in parentheses. Can also specify an output variable you want the result of the function to be saved in. Can pass multiple arguments or specify multiple outputs.

function header
 The first line of a function. Includes:
 function [outputargument(s)] = functionname(inputargument(s))
 *NOTE: the functionname should be what the function itself is saved under.
 The input and output arguments in the function declaration DO NOT have to be the same as the ones used when it's being called; they should just specify the types of arguments that will be entered. Ex: area(length,width).

xor
 A logical function; takes xor(A, B) and returns logical true ONLY IF one of the elements, but not both, is nonzero.
 A = 0, B = 0, xor(A,B) = 0
 A = 1, B = 0, xor(A,B) = 1
 A = 0, B = 1, xor(A,B) = 1
 A = 1, B = 1, xor(A,B) = 0

sind
Returns the sin of the argument in degrees.

menu
 Will display a Figure Window with push buttons for the choices. The first string passed is the heading, the rest are the labels. Ex: mypick = menu('Pick one', 'Green', 'Blue', 'Red'); this will store the equivilent numerical value in the variable mypick (1 for green, 2 for blue, etc...).
 Uses either an ifelse or switch statement to take an action based on the button pressed.

isletter
Returns logical 1 if the argument is a letter of the alphabet or not: isletter('h') = 1. Need to put the argument in string quotes.

isempty
Returns logical true if a variable is empty, logical false if it has a value, or an error message if the variable does not exist. Will also determine whether or not a string variable is empty (ex: can determine whether or not the user entered a value into an input function).

iskeyword
Will determine whether or not something is a keyword and if it can be used as an identifier name. By itself (iskeyword), it returns all the keywords in MATLAB.

Relational operators
 > greater than
 < less than
 >= greater than or equals
 <= less than or equals
 == equality
 ~= inequality

Logical operators
  or for scalars
 && and for scalars
 ~ not

Truth Table for Logical Operators
 xyxx  yx&&yxor(x,y)
 true truefalsetruetruefalse
 truefalsefalsetruefalsetrue
 falsefalsetruefalsefalsefalse

if
 Conditions in if statements use logical expressions (relational expressions). Chooses whether or not another statement or group of statements is executed. Form:
 if condition
 action
 end
 If the if condition is true, action is executed; if not, not executed.
 If you just enter a value in the if condition (ex: if 5), then it takes a logical value and says that it's true and executes the action.

ifelse
 Choosing between two statements or sets of statements. Will either execute one or the other. Form:
 if condition
 action1
 else
 action2
 end
 If condition 1 is true, does that. If it's not, goes to else and executes action2. Can nest them, so multiple else statements; that way, can choose between more than two statements.

elseif
 Way of choosing among many options instead of using nested ifelse statement. Form:
 if condition1
 action1
 elseif condition2
 action2
 elseif condition3
 action3
 else
 finalaction
 end

switch
 Often used in place of a nested ifelse statement; used when an expression is tested to see whether it is equal to one of the several possible values. Form:
 switch switch_expression
 case caseexp1
 action1
 case caseexp2
 action2
 case caseexp3
 action3
 otherwise
 action
 end
 If there are more than one cases, use curly braces (case {10 9})

elseif clause
Can use this instead of nesting ifelse statements if choosing among more than two actions.

while
 A conditional loop. The action is executed as long as the condition is true. It must become false for the look to stop; if in an infinite loop, hit CtrlC. Format:
 while condition
 action
 pause(0) %just good practice
 end
 Can have multiple conditions using if statements.
 Good for errorchecking.

for
 A counted loop. When number of repetitions is known ahead of time. The loop variable is the one that's iterated through (ex: i). Format:
 for loopvar = range
 action
 end
 Common uses: calculating running sums and products, printing results of something, creating vectors, etc.

end
Always the end of a loop.

factorial
Will find the factorial of any integer: factorial(5) returns 120. Could use a for loop with a running product, but this is easier.

sum
Can vectorize sums and sum all the elements at once. Ex: sum(vec) will return the sum of all the elements. Operates columnwise and sums each column in a matrix so it returns a vector of all the column sums.

prod
Can vectorize and multiply all the elements of a vector at once. Ex: prod(vec) returns the product of all those elements. Multiplies the elements in each column (operates columnwise), so returns a vector with products of each column.

cumsum
 Returns a vector of running sums, so will show what one element is, and then what the next sum is, then the next, etc...
 Ex: vec = [5 9 4]
 cumsum(vec)
 5 14 18
 With a matrix, returns a first row with the matrix argument, and then a sum of the values in the first and second rows (for a 2row matrix).

cumprod
Returns a vector of the running procuts. The first value is the first element of the vector, followed by the first value the cumprod function returns, then the next, etc. For a matrix, returns a matrix of the first row, then the product of the first and second rows (for a 2row matrix).

min
Can find the min of a vector, will find the min value. min(vec) returns the min. Operates columnwise on a matrix, find the min in each column.

max
Can find the max value in a vector. max(vec). Operates columnwise on a matrix and will find the max in each column.

array operators
 How to do numerical operations that involve multiplying on entire vectors or matrices. Use the dot operator before:
 .^, .*, ./, .\

any
Returns logical true if any element in a vector is logically true, false if not. Ex: vec = [0 1 2 34]; any(vec) = 1.

all
Returns logical true only if all the elements in a vector are true, false if not. Ex: vec = [0 1 2 3 4]; all(vec) = 0.

find
Returns the indices of a vecotr that meet some criteria. Ex, to find all the elements in a vector that are greater than five, find(vec>5).

Matrix or/and operators
Work elementwise:  is or; & is and. The double operators ( and &&) only work for scalars.

sign
Finds the sign of each element in a matrix and returns it, either 0, 1, or 1.

header of a function
 Includes the word function, then any output arguments it might return, the name of the functionw hich ist he same as the Mfile it's saved as, the input arguments in parentheses, and a comment that describes what the function does.
 function [output arguments] = functionname(input arguments)
 %Comment describing the function

modular program
A program taht's broekn down into sections and each is implemented as a separate function. The script is the main program that combines and calls all these functions.

subfunction
These functions can be stored in the same Mfile as the primary function. Calling one function calls the other

syntax error
Mistakes in using the language, like spelling or missing a comma, quotation mark.

Runtime/executiontime error
Found when a script or function is executing, like attempting to divide by zero. Will generate a warning message in MATLAB. also, attempting to refer to an element in an array that doesn't exist.

Logical error
Difficult to locate, mistake in reasoning by the programmer, not in the programming language. Ex: dividing instead of multiplying.

breakpoints
Places to examine varaibles or expressions. Done in the Editor/Debugger or using builtin commands.

dbstop
 Sets a breakpoint in the specified line. Format:
 dbstop functionname line#
 Allows to type variable anmes/expressions to examine their values at that point in the execution.

dbcont
Continues the execution, goes to the next step.


function stub
A placeholder ina stub, can help when a script isn't finished yet, so you can keep going through the script despite not knowing everything that goes into it. Consist of the proper function headers, followed by a simulation of what the function will eventually do (ex: it puts arbitrary values in for the output argumetns).

strcat
Concatenates string vectors horizontally. Ex: first = 'bird'; second = 'house'. strcat(first,second) = 'birdhouse'. Will remove trailing blanks but not leading blanks from strings before concatenating. Just regularly concatenating (newstr=[first second]) will not do that.

strvcat
Concatenates strings vertically, so it creates a column vector of strings. It will pad the smaller strings with extra blanks so that they both have the same length.

char
Creates a matrix of characters. Will automatically pad the strings with rows and blanks as necessary sot hat they are all the same length, like strvcat. Ex: greetmat = char('Hello', 'Goodbye'); size(greetmat) = 2 7.

blanks
Will create a string of n blank characters. (Hard to see!) Best when concatenating strings if you want a number of blank spaces between. Transposing blanks (ex: blanks(5)') will move the cursor down a certain number of lines. Like printing the newline character several times.

sprintf
Works exactly like the fprintf function, but instead of printing it creaets a string. Can link it to a variable or something and give that a string value; allows for formatting of string variables. Good for prompts, labels, and arguments to functions. Sprintf can also create a string that can be displayed in the input function.

deblank
Removes blank spaces from the end of a string. Good for depadding string matrix elements. Removes ONLY the trailing blanks.

strtrim
Removes both trailing and leading blanks from a string, but not any blanks in the middle.

upper
Converts a string to all uppercase letters.

lower
Converts a string to all lowercase letters.

strcmp
Compares strings, character by character. Returns logical true if the strings are completely identical (must also be the same length), logical false if not the same length or if any of the corresponding characters are not identical. Takes to arguments, the string variables to be compared.

strncmp
Compares only the first n characters in strings and ignores the rest. The first two arguments are the strings to compare, and the third argument is the number of characters to compare (the value of n). Ex: strncomp(word1,word2,3).

strcmpi
The same as strcmpi, except it ignores the case of the letters. So, it takes two arguments, the strings to be compared, and returns logical true if they're all the same except for case, and returns logical false if they're not the same size or if the characters don't correspond.

strncmpi
The same as strncmpi except ignores case. So, it takes 3 arguments, the first two being the strings to be compared, and the third being the number of characters to compare from the beginning of each string.

findstr
Receives two strings as input arguments, finds all occurrences of the shorter string within the longer, returns the subscripts of the beginning of the occurrences. Ex: findstr('abcde', 'd'); ans = 4. findstr('d','abcde'); ans = 4. findstr('abcdeabcdedd', 'd'); ans = 4 9 11 12. Returns an empty vector if there are no occurrences.

strfind
Does the same thing as findstr, except the order of thea rguments maeks a difference. The general form is strfind(string, substring); it finds all occurrences of a substring within the string and returns the subscripts. If there are no occurrences, empty vector returned.

delimiter
A character or set of characters that act as a separator within a string. By default, it is any whitespace character.

strtok
 Separates strings into two substrings. Receives one string as input, looks for the first delimiter, then returns a token (the beginning of the string up to but not including the first delimiter). Also returns the rest of the string, which includes the delimiter. Assign two output variables to capture both. Can alternate what the delimiters are, though.
 [token rest] = strtok(string, delimeters) will return a token that is the beginning of the string up to the first character contained within the delimiters string, and ther est of the string. Ex: [token rest] = strtok('hello', 'l'); token = He rest = llo.
 Leading delimiter characters are ignored.

strrep
 Finds all occurrences of a substring with a string and replaces them with a new substring. All strings can be any length, and the lengths of the old and new substrings don't have to be the same. The order of the arguments matters:
 strrep(string, oldsubstring, newsubstring).

date
Returns the current date as a string.

eval
Used to evaluate a string as a function. Ex: eval('plot(x)') will evaulate the string 'plot(x)' as a function and do it.

isletter
Returns logical true if the character is a letter of the alphabet. Goes elementwise for each letter/character in the string. Ex: isletter('a2') = 1 0

isspace
Returns logical true if the character is a whitespace character. If a string is passed, will return logical true or false for every element.

ischar
Returns logical true if any array is a character array or logical false if not. Ex: ischar('EK127') = 1; iscar(3:5) = 0.

int2str
Converts integers into strings.

num2str
Converts real numbers into strings. If only the real number is passed to the argument, it will create a string that has four decimal places. The precision can be specified in the second argument.

str2num
Takes a string in which a number is stored and converts it to a double, default 4 decimals. If a string has numbers separated by blanks, it will convert it into a vector numbers, default type double.

cell
Can be used to preallocate a cell, then can fill in arguments later. Takes 2 arguments, the 2 dimensions. Takes the arguments in parentheses instead of {}, which would normally be used when referring to fields within a cell array.

{ }
Used with cell arrays. For creating cell arrays with known values, referring to individual elements of cell arrays: {#} for vector, {#,#} for matrix. Can assign individual elements values that way as well. cellmat{1,2} = 3.

referring to elements in cell arrays
 cellmat = {23 'a'; 1:2:9 'hello'}
 cellmat alone will display the arguments: [ 23 'a' 1x5 double 'hello']
 cellmat(2) = 1x5 double (operates columnwise)
 cellmat{2} or cellmat{2,1} = 1 3 5 7 9
 cellmat{2,1}(4) = 7 (to index into the cell array, use curlies. Parentheses for the element of the vector itself.)

subsets of cell arrays
 cellvec{2:3} = 1 3 5 7 9, 'a'
 Indexes a subset of that cell array, individual elements, operating columnwise.

celldisp
Recursively displays all elements of the cell array in separate lines. Can either specify celldisp(cellmat), which will display elements as cellmat{1,1}, cellmat{1,2}, etc... OR can do: celldisp(cellmat,'newname'), which takes that newname to display: newname{1,1}, newname{1,2}, etc...

cellplot
Graphical display of the cell array in a Figure Window. Just displays the same information as typing the name of the variable (doesn't show the contents, just the stuff like 1x5 double).

length(cellvec); size(cellvec); cellvec{end}
 Length will display the number of elements (vector) or the highest dimension (matrix) of a cell array.
 Size will display the number of rows and the number of columns.
 End will index the last element of a cell array.

deleting a row or column from a cell array
 Reference that individual row or column with an empty vector:
 cellmat(1,:) = []; this deletes the entire first row.

cellstr
Converts a character array padded with blanks to a cell array in which the trailing blanks have been removed. Basically, takes a matrix or a vector of strings and converts it into a cell array with no blanks.

char
 Can convert from a cell array to a character matrix. Will also create a character array with each input argument being a separate row: char('a','b','c') = a;b;c padded with any blanks as necessary.
 cnames = char(names) creates a character matrix out of a cell array.

iscellstr
Logical true if a cell array is a cell array of all strings, logical false if not.

structure
A data structure that groups together values that are logically related in what are called fields of the structure. The fields are named, which helps to make it clear what the values are that are stored in the structure. They are not arrays, though, and they don't have elements. Can't loop through the values in a structure as one could do with an array.

hierarchy of structure elements
 student = the entire data structure, which is a vector of structures
 student(1) = an element from the vector, which is an individual structure
 student(1).quiz = the field from the structure, which is a vector of doubles
 student(1).quiz(1) = an individual double quiz grade.

struct
Creates a structure. Takes the form: structname = struct('fieldname1',value,'fieldname2',value,etc...)

dot operator to refer to structure fields
 structname.fieldname = value; can assign values like that to individual fields. With vectors of structures, refer to the specific lines:
 structname(1).fieldname

rmfield
Removes a field from a structure and returns a new structure with the field removed, but does not modify the original structure unless the returned structure is assigned to that variable. Ex: rmfield(newpack, 'code'). Gets rid of one of the fields.

isstruct
Returns logical 1 if it's a structure variable, 0 if not.

isfield
Returns logical ture if a fieldname as a string is a field in the structure argument, logical false if not. Ex: isfield(package,'cost') = 1.

fieldnames
Returnst he names of the fields that are contained in a structure variable. It's a cell array because they're all varying lengths. Curly braces used to refer to the elements, then.

nested structures
 Structures within structures. Ex:
 lineseg = struct('endpoint1',struct('x',2,'y',4),'endpoint2',struct('x',1,'y',6))
 OR
 lineseg.endpoint1.x
 lineseg.endpoint2.y

fopen
 Returns 1 if not opened, or any integer value which becomes the file identifier if it's successful. Often store file identifier as fid.
 Permission strings: 'r' (read); 'w' (write); 'a' (append).

fclose
Returns 0 if closed successfully, 1 if not.

fscanf
 Reads formatted data into a matrix using conversion formats like %d. Format: datamat = fscanf(fid,'format',[dimensions]). Dimensions can either be specific, or if you know the number of rows but not the number of columns (this operates columnwise), then can specify inf as the second dimension.
 Stores values in all the same type, numerical and not characters.

fgetl
Reads the file on line at a time as a string vector, and deletes the newline character at the end. Done in some form of a loop, whereas textscan/fscanf can get entire data in one go. More control over how the data is read than any other, because only reads one line at a time.

fgets
Reads strings from a file one line at a time and keeps the newline character at the end. fgets(fid,nchar) allows you to specify how many characters you want.

feof
Specifies the end of the file, logical true if it's at the end of the file, logical false if not. In a while loop, can do feof(fid) == 0 OR while ~feof(fid) (which means while not equal to the end of the file).

textscan
Reads text data from a file and stores it in a cell array as opposed to a matrix like fscanf does. That way, differing lengths and retains the individual characteristics instead of converting all to numerical data. Format: cellarray = textscan(fid, 'format'). Allows you to specify what format the cell array fields are. Ex: subjdata = textscan(fid, '%f %c') specifies that on each line there's a float followed by a space followed by a character, and it creates a cell array that's a 1 x 2 with a [double] and [char]. To refer to individual values, index with curly braces and then parentheses: subjdata{1}(2).

fprintf
Allows writing to files if the file identifier is specified and the file was opened with the permission 'w'. fprintf(fid,'format',variable). Can also be used for appending to the end of a file if it's opened with the permission 'a'.

xlswrite
Allows writing to a spreadsheet file with the extension .xls. Ex, create a matrix and then use xls('titleofdoc',matrix).

xlsread
 Reads from a spreadsheet file. Don't need to add the .xls extension because that's the default.
 matrix = xlsread('datafilename'). If there are more than one kind of value in the spreadsheet (like characters and numbers and strings), can create multiple outputs to capture:
 [nums, txt] = xlsread('datafilename'); nums will capture into a double vector and txt will capture strings into a cell array. Say the format looked like this for the original spreadsheet: %c %d %s (character, integer, string). [num txt] would capture first the number values and store that, and then all the string values in an r x 3 cell array, because there were 3 columns originally. Because there were only 2 columns of strings, the middle column will be blank. That way, keeps the original format.

anonymous function
 A simple, oneline function that does not need to be saved as its own .m file, and can instead be saved under its function handle and called within another script or program. Can save it in a MAT file if it's super helpful (save filename or save filename append).
 fnhandle = @(arguments) functionbody. Even when an anonymous function takes no input argument, it must still have empty parentheses passed to it: funhandle().

str2func
Will convert a string to a function handle.

func2str
Will converrt a function handle to a string. Coudl be used to put the name of the function in a plot, for example.

fplot
Plots a function between limits that are specified. Format: fplot(fnhandle, [xmin xmax]).

feval
Will evaluate a function handle and execute the function for a specified argument. format: feval(@sin, argument).

varargin
A builtin cell array that can be used to store a variable number of input arguments. CELL ARRAY. Use curly braces to refer to any element in varargin.

varargout
Can be used to store a variable number of output arguments in a cell array.

nargin
Returns the number of input arguments that were passed to the function. Returns the total number of input arguments, not just the number of arguments in the cell array varargin.

nargout
Determines how many output arguments expected. Can be called to determine how many output arguments were used to call a function. Doesn't return the number of output arguments in the function header, but the number of output arguments expected from the function.

nested function
Outer function can have an inner function within it, and every function must have an end statement. A variable in the outer function can be used in the inner.

end (for functions)
Must have an end statement for nested functions.

recursive function
 A function that calls itself. The expressions are put on hold with the interruption of the general case of the recursive definition. When you get to the base case, that's evaluated, and then everything else can be evaluated from that point out the first case that was put on hold.
 There must always be a base case at which recursion ends, otherwise it's infinite recursion.
 Starts with the base case, and then the rest of the function. Ex:
 if n == 1
 facn = 1
 else
 facn = n * fact(n1);
 end

subplot
Creates a matrix of plots in the current Figure Window. Form: subplot(r,c,n) where r is the number of rows of figures, c is the number of columns of figures, and n is the figure number (operating rowwise).

barh
Creates a horizontal bar chart. Groups together the values in each row, so if you pass a matrix to the barh or bar function, it will have one grouping of data that is the first row, and a second grouping that is the second row. Can customize the width by passing the width after the x and y vectors to be plotted. A width of .6 = more space between bars than a width of 1.2 (the bars will overlap).

area
Draws a plot as a continuous curve and fills in the area under the curve.


hist
 Creates a histogram, uses just one input argument (a vector) and charts the frequency of occurrence of values within a vector. Uses bins to collect values that are in given ranges.
 hist(vec) will take the values in the vector and put them into 10 bins by default. hist(vec,n) will put them into n bins.

'stack'
Stacks rather than groups values, so the y value represented by the top of the bar is the sum of the values from that row.

pie
 Creates a pie chart. pie(vec) draws the chart using the percentage of each element of vec of the whole. Starts at the top of the circle and goes around counterclockwise. Can use a cell array to label them.
 Can explode a pie chart. 2 vectors are passed to the argument. First, a data vector, and second, a logical vector. The data vector has all the values that will create the chart; the logical vector when true will have that element exploded. A third cell array argument can be passed to have labels.

comet
Shows the plot by showing the first point and the moving to the next point leaving a trail of all the previous points. The end result looks the same as plot(x,y).

movie
Displays recorded movie frames. The frames are captured in a loop using the builtin function getframe, and then stored in a matrix.

getframe
Captures frames in a loop and stores them in a matrix for a movie.


bar3
3D bar chart. x and y vectors passed to it.

pie3
Shows data from a vector as a 3d pie.


grid
Toggles the grid and makes 3D plots easier to see.

object handle
Unique real number that is used to refer to the object. Various plot functions return a handle for the plot object, which can then be stored in a variable. Closing a figure window makes the object handle invalid because the plot doesn't exist anymore.

get
Displays the property of the object, by passing the object handle as the input argument. Shows color, linestyle, linewidth, etc.

set
Can change any of the properties displayed in the get function. How to call: set(objhandle, 'PropertyName', property value). Ex: to set a line width: set(handle, 'LineWidth', 1.5). They can also be set in the original function call.

mean
Calculates the arithmetic mean/average. Operates columnwise.

var
Calculates the variance, which is the sqrt of the standard deviation.

std
Calculates the standard deviation.

mode
Displays the most frequently occurring value. If there are more than one, it shows the smallest; if there are none, it shows the smallest value in the entire data set.

median
Displays the median. Requires sorting the data first, but this function will automatically do that beforehand if data is not sorted.

union
Gets all the values from two input vector arguments and displays them in one vector, without repeating. Passing extra output arguments allows you to see the indices of these values in the two vectors.

intersect
Shows the values that appear in both input vectors; can get the indices as well.

unique
Shows all the values that are unique from a set argument.

setdiff
The order of the input arguments matters; takes the first vector and then shows all the values that are in the first vector and not in the second vector.

setxor
Receives two vectors and shows all the values in both vectors that are not in the intersection of the two vectors; basically does what doing setdiff twice would do.

ismember
Receives two vectors as input arguments and returns logical vector that is the same length as the first argument, containing 1 if the element in the first vector is also in the second, and 0 if not.

issorted
Returns 1 if sorted in ascending order, 0 if not.

sort
Sorts in ascending order, columnwise for matrices. If you specify 'descend' as the second argument, it will sort in descending order.

sortrows
For string variables; it sorts the first element in each row but not the rest of it, so your words stay intact. Just doing sort on a matrix/vector of string variables would sort the entire string in each row.

