User Tools

Site Tools


Matlab - help

Given the great range of functions that are already built into Matlab as well as the fact that additional functions can be added to the environment by means of “toolboxes” (folders containing sets of functions that depend on one another and that, as a whole, can be considered a program or functionality set of its own), Matlab offers a rudimentary but extremely helpful way for the user to inquire about available functions.

The help function

On the command line, you can enter just “help” (which calls the internal help function provided by Matlab). This will produce a list containing hyperlinks that can be clicked on, with one entry per installed toolbox, which includes the toolboxes that come with Matlab itself. Important toolboxes (and associated functions) are:

  • codetools (functions to edit and work with user-written code files):
    • edit (invokes a fully functional editor with syntax highlighting and step-by-step debugger)
    • keyboard, dbstop, dbclear, dbstep, dbup, dbdown, dbstack, dbcont (debugging functions, see debugging section)
  • datafun (functions to calculate basic statistics and transform data):
    • max, min (maximum and minimum over one dimension of an array or between two arrays)
    • mean, median, mode (central tendency over one dimension of an array)
    • var, std (variance and standard deviation)
    • sort (sorting of elements, can be used to sort associated lists)
    • sum, cumsum, prod, cumprod (optionally cumulative sum and product over one dimension of an array)
    • diff (discrete derivative)
    • corrcoef (correlation coefficient)
    • cov (covariance matrix)
    • conv, convn (convolution)
    • detrend (detrending)
    • fft, fftn, ifft, ifftn, fftshift (fast-fourier-transform, FFT functions)
  • elfun (elementary math functions)
    • sin, sinh, asin, asinh, cos, cosh, acos, acosh, tan, tanh, atan, atan2, atanh (and others, trigonometrical functions)
    • exp, log, log10, log2, pow2 (exponential/logarithm functions)
    • sqrt (square root)
    • abs (absolute value)
    • complex, real, imag (complex value generation/creation/inspection)
    • fix, round, floor, ceil (rounding)
    • mod, rem (modulus, remainder)
    • sign (numeric sign)
  • elmat (elementary matrix functions)
    • zeros, ones (create matrices to reserve memory with neutral element)
    • repmat (replicate value, vector, or matrix N-times in several dimensions)
    • size, length, numel, ndims (size of array)
    • cat (catenate arrays in a desired dimension)
    • permute (reordering dimensions)
    • reshape (reshape array, dimension folding/splitting)
    • squeeze (remove 1-size dimensions)
    • find (convert array into list of non-zero/true values)
    • sub2ind, ind2sub (converting matrix addressing options)
    • ndgrid (create indexing arrays)
  • general (general purpose functions)
    • who, whos, clear (workspace manipulation/inspection)
    • load, save (variable to/from disk operations)
    • which (resolve symbol to variable or function name, incl. location, also files)
    • path, addpath, rmpath, savepath, pathtool, rehash (path manipulation functions)
    • diary (output console content, i.e. commands and returned values, into file)
    • format (format default output options)
    • cd, pwd (change/display current directory)
    • dir (list directory contents)
    • ! (exclamation point: run system command)
  • lang (language help!)
    • global, persistent (variable memory storage type declaration)
    • function (declare/begin function)
    • if, else, elseif (conditional execution of statements)
    • for (pre-defined loops)
    • while (conditional loops)
    • break, continue (terminate loop, skip rest of loop cycle)
    • switch, case, otherwise (expression based selection of code)
    • try, catch (internal error handling)
    • end (terminates control flow structures: if, for, while, switch, try)
    • error (throw exception/error)
    • return (leave function)
    • parfor, spmd (parallel processing keywords, end also terminates)
    • eval, feval, evalin, builtin, assignin (evaluation of function by name/handle)
    • exist (test if file/variable exists)
    • nargin, varargin, nargout, varargout (argument handling)
    • ans (default variable if output is not suppressed)
  • matfun (matrix functions)
    • rank, det, trace (rank, determinant, trace of matrix)
    • inv, pinv (inverse, pseudo-inverse)
    • eig, svd (eigenvalues/eigenvectors, SVD)
  • ops (operators)
  • polyfun (polynomial functions)
    • interp, interpn (interpolation)
  • randfun (random number functions)
    • rand, randn (uniform, and normally distributed numbers)
    • randperm (random permutation)
  • strfun (string-manipulation functions)
    • char (convert to character)
    • cellstr (convert 2D character array into list of strings)
    • deblank (remove trailing blank characters of string/s)
    • strcmp, strcmpi (string comparison)
    • strfind (find string in another)
    • strrep (replace one string with another)
    • regexp, regexpi, regexprep (regular expression match/replacing)
    • lower, upper (convert character case)
    • num2str, str2num, str2double (convert between numbers and strings)
    • sprintf (format strings)
  • timefun (time-related functions)
    • now (return internal clock value)
    • date, datenum, datestr, datevec (date related functions)
    • tic, toc (timing functions)
    • pause (waiting)

To get additional help on any of these functions, simply enter help FUNCTION.

Online help

In addition to the help available within Matlab, Mathworks offers an online version of the help (which contains further examples and tips). For instance, this the online help article for the strfind function.

matlab_-_help.txt · Last modified: 2012/11/12 18:45 by jochen