MATLAB Function Reference Previous page   Next Page

Programming in MATLAB

M-File Functions and Scripts

( ) Pass function arguments
% Insert comment line into code
... Continue statement to next line
depfun List depencies of M-file or P-file
depdir List dependent directories of M-file or P-file
echo Echo M-files during execution
end Terminate block of code
function Declare M-file function
input Request user input
inputname Return variable name of function input
mfilename Return name of currently running M-file
namelengthmax Return maximum identifier length
nargin Return number of function input arguments
nargout Return number of function output arguments
nargchk Validate number of input arguments
nargoutchk Validate number of output arguments
pcode Create preparsed pseudocode file (P-file)
script Script M-file description
varargin Accept variable number of arguments
varargout Return variable number of arguments

Evaluation of Expressions and Functions

builtin Execute built-in function from overloaded method
cellfun Apply function to each element in cell array
echo Echo M-files during execution
eval Execute string containing MATLAB expression
evalc Evaluate MATLAB expression with capture
evalin Execute MATLAB expression in specified workspace
feval Evaluate function
iskeyword Determine if input is MATLAB keyword
isvarname Determine if input is valid variable name
pause Halt execution temporarily
run Run script that is not on current path
script Script M-file description
symvar Determine symbolic variables in expression
tic, toc Measure performance using stopwatch timer

Timer Functions

delete Delete timer object from memory
disp Display information about timer object
get Retrieve information about timer object properties
isvalid Determine if timer object is valid
set Display or set timer object properties
start Start timer
startat Start timer at specified time
stop Stop timer
timer Create timer object
timerfind Return array of all visible timer objects in memory
timerfindall Return array of all timer objects in memory
wait Block command line until timer completes

Variables and Functions in Memory

assignin Assign value to variable in specified workspace
datatipinfo Produce short description of variable for debugger DataTips
genvarname Construct valid variable name from string
global Declare global variables
inmem Return names of M-files, MEX-files, Java classes in memory
mislocked Determine if M-file or MEX-file cannot be cleared from memory
mlock Prevent clearing M-file or MEX-file from memory
munlock Allow clearing M-file or MEX-file from memory
namelengthmax Return maximum identifier length
pack Consolidate workspace memory
persistent Define persistent variable
rehash Refresh function and file system path caches

Control Flow

break Terminate execution of for or while loop
case Execute block of code if condition is true
catch Specify how to respond to error in try statement
continue Pass control to next iteration of for or while loop
else Conditionally execute statements
elseif Conditionally execute statements
end Terminate conditional block of code
error Display error message
for Execute block of code specified number of times
if Conditionally execute statements
otherwise Default part of switch statement
return Return to invoking function
switch Switch among several cases, based on expression
try Attempt to execute block of code, and catch errors
while Repeatedly execute statements while condition is true

Function Handles

class Create object or return class of object
feval Evaluate function
function_handle Handle used in calling functions indirectly
functions Return information about function handle
func2str Construct function name string from function handle
isa Determine if input is object of given class (e.g. function_handle)
isequal Determine if function handles are equal
str2func Construct function handle from function name string

Object-Oriented Programming

MATLAB Classes and Objects
class Create object or return class of object
fieldnames List public fields belonging to object
inferiorto Establish inferior class relationship
isa Determine if input is object of given class
isobject Determine if input is MATLAB OOPs object
loadobj User-defined extension of load function for user objects
methods Display information on class methods
methodsview Display information on class methods in separate window
saveobj User-defined extension of save function for user objects
subsasgn Overloaded method for A(I)=B, A{I}=B, and A.field=B
subsindex Overloaded method for X(A)
subsref Overloaded method for A(I), A{I} and A.field
substruct Create structure argument for subsasgn or subsref
superiorto Establish superior class relationship
 
Java Classes and Objects
cell Convert Java array object to cell array
class Create object or return class of object
clear Clear Java import list or Java class definitions
depfun List Java classes used by M-file or P-file
exist Determine if input is Java class
fieldnames List public fields belonging to object
im2java Convert image to instance of Java image object
import Add package or class to current Java import list
inmem Return names of M-files, MEX-files, Java classes in memory
isa Determine if input is object of given class
isjava Determine if input is Java object
javaaddpath Add entries to dynamic Java class path
javaArray Construct Java array
javachk Generate error message based on Java feature support
javaclasspath Set and get dynamic Java class path
javaMethod Invoke Java method
javaObject Construct Java object
javarmpath Remove entries from dynamic Java class path
methods Display information on class methods
methodsview Display information on class methods in separate window
usejava Determine if Java feature is supported in MATLAB
which Display package and class name for method

Error Handling

catch Specify how to respond to error in try statement
error Display error message
ferror Query MATLAB about errors in file input or output
intwarning Control state of integer warnings
lasterr Return last error message
lasterror Last error message and related information
lastwarn Return last warning message
rethrow Reissue error
try Attempt to execute block of code, and catch errors
warning Display warning message

MEX Programming

dbmex Enable MEX-file debugging
inmem Return names of M-files, MEX-files, Java classes in memory
mex Compile MEX-function from C or Fortran source code
mexext Return MEX-filename extension

Previous page  Operators and Operations File I/O Next page

© 1994-2005 The MathWorks, Inc.