Skip to content

MATLAB

Getting Started

Introduction

MATLAB is short for matrix laboratory


Matrix and array operations {.row-span-3}

MATLAB allows you to use a single arithmetic operator or function to manipulate all values in a matrix

a + 10

MATLAB will execute the above statement and return the following results:

ans = 3×3
11 13 15
12 14 16
17 18 20

sin(a)

MATLAB will execute the above statement and return the following results:

ans = 3×3
0.8415 0.1411 -0.9589
0.9093 -0.7568 -0.2794
0.6570 0.9894 -0.5440

To transpose a matrix, use single quotes (')

a'

ans = 3×3
1 2 7
3 4 8
5 6 10

Perform standard matrix multiplication using the * operator, which computes the inner product between rows and columns

p = a*inv(a)

p = 3×3
1.0000 0 0
0 1.0000 0
0 0 1.0000

concatenation {.row-span-2}

Concatenation is the process of joining arrays to form larger arrays. In fact, the first array is formed by concatenating its elements. Pairs of square brackets [] are concatenation operators.

A = [a,a]

A = 3×6
1 3 5 1 3 5
2 4 6 2 4 6
7 8 10 7 8 10

Concatenating arrays next to each other using commas is called horizontal concatenation. Each array must have the same number of rows. Likewise, semicolons can be used for vertical concatenation if the arrays have the same number of columns.

A = [a; a]

A = 6×3
1 3 5
2 4 6
7 8 10
1 3 5
2 4 6
7 8 10

Matrices and arrays {.row-span-3}

To create an array with four elements per row, separate elements with commas (,) or spaces

a = [1 2 3 4]

MATLAB will execute the above statement and return the following results:

a = 1×4
1 2 3 4

Create a matrix with multiple rows

a = [1 3 5; 2 4 6; 7 8 10]

a = 3×3
1 3 5
2 4 6
7 8 10

5×1 column vector of zeros

z = zeros(5,1)

z = 5×1
0
0
0
0
0

Complex number

A complex number has a real part and an imaginary part, and the imaginary unit is the square root of -1.

sqrt(-1)

ans = 0.0000 + 1.0000i

To represent the imaginary part of a complex number, use i or j.

c = [3+4i, 4+3j; -i, 10j]

c = 2×2 complex
3.0000 + 4.0000i 4.0000 + 3.0000i
0.0000 - 1.0000i 0.0000 +10.0000i

Basic knowledge

Input the command

--
ansMost recently calculated answer
clcClear the command line window
diaryRecord the text of the command line window into the log file
formatSet the output display format
homeSend cursor reset
iskeywordDetermine if the input is a MATLAB keyword
moreControl paging output in the command line window
commandwindowSelect command window
commandhistoryOpen command history window

Objects

--
DisplayFormatOptionsOutput display format in the command line window

Matrices and Arrays {.row-span-5}

Create and combine arrays

--
zerosCreate an array of all zeros
onesCreate an array of all 1s
randUniformly distributed random numbers
trueLogical value 1 (true)
falselogical 0 (false)
eyeidentity matrix
diagCreate a diagonal matrix or get the diagonal elements of a matrix
blkdiagblock diagonal matrix
catConcatenate arrays.
horzcatConcatenate arrays horizontally
vertcatConcatenate arrays vertically
repelemRepeat array element copy
repmatRepeat array copy

Create grid

--
linspaceGenerate linearly spaced vectors
logspaceGenerate logarithmic spaced vectors
freqspacefrequency spacing of frequency response
meshgrid2D and 3D grids
ndgridRectangular grid in N-dimensional space

Determine size, shape and order

--
lengthThe length of the largest array dimension
sizearray size
ndimsNumber of dimensions of the array
numelthe number of array elements
isscalarDetermine whether the input is a scalar
issortedDetermine if the array is sorted
issortedrowsDetermine whether the rows of a matrix or table are sorted
isvectorDetermine whether the input is a vector
ismatrixDetermine whether the input is a matrix
isrowDetermine whether the input is a row vector
iscolumnDetermine whether the input is a column vector
isemptyDetermine whether the array is empty

Refactor and rearrange

--
sortSort array
elements sortrowsSort matrix rows or table rows
flipFlip the order of elements
fliplrFlip the array from left to right
flipudFlip the array from top to bottom
rot90Rotate an array by 90 degrees
transposeTranspose a vector or matrix
ctransposecomplex conjugate transpose
permutepermute array dimension
ipermuteInverse permutation of array dimensions.
circshiftCircular shift array
shiftdimshift array dimension
reshapeReshape array
squeezeRemove dimensions of length 1

index

--
colonvector creation, array subscript and for loop iteration
endTerminate a code block or indicate the maximum array index
ind2subConvert linear index to subscript
sub2indConvert subscript to linear index

Value type {.row-span-2}

Create numeric variables

--
doubledouble precision array
singlesingle precision array
int88-bit signed integer array
int1616-bit signed integer array
int3232-bit signed integer array
int6464-bit signed integer array
uint8Array of 8-bit unsigned integers
uint1616-bit unsigned integer array
uint3232-bit unsigned integer array
uint6464-bit unsigned integer array

Convert between numeric types

--
castConvert variables to different data types
typecastConvert data types without changing the underlying data

Query type and value

--
allfiniteDetermine if all array elements are finite
anynanDetermine if any array element is NaN
isintegerDetermine whether the input is an integer array
isfloatDetermine whether the input is a floating-point array
isnumericDetermine whether the input is a numeric array
isrealDetermine whether the array uses complex storage
isfiniteDetermine which array elements are finite
isinfDetermine which array elements are infinite
isnanDetermine which array elements are NaN

Value range

--
epsFloating point relative precision
flintmaxThe largest consecutive integer in floating point format
InfCreate an array with all values Inf
intmaxThe maximum value of a specific integer type
intminThe minimum value of a specific integer type
NaNCreate an array where all values are NaN
realmaxThe largest positive floating point number
realminMinimum standard floating point number

Loops and conditional statements

--
if, elseif, elseExecute statement when condition is true
switch, case, otherwiseExecute one of multiple sets of statements
forA for loop used to repeat a specified number of times
whileA while loop that executes repeatedly while a condition is true
try, catchExecute the statement and catch the resulting error
breakTerminate execution of a for or while loop
returnReturn control to the calling script or function
continuePasses control to the next iteration of a for or while loop
pauseTemporarily suspend the execution of MATLAB
parforParallel for loop
endTerminate a code block or indicate the maximum array index

{.style-list}

Array of strings

--
stringstring array
stringsCreate a string array that does not contain characters
joinMerge strings
plusAdd numbers, append strings

Character array

--
charcharacter array
cellstrConvert to a cell array of character vectors
blanksCreate a blank character array
newlineCreate newline

Character or string array

--
composeFormat data into multiple strings
sprintfFormat data as string or character vector
strcatConcatenate strings horizontally
appendMerge strings

Char or string -convert input arguments

--
convertCharsToStringsconvert character array to string array, other arrays remain unchanged
convertStringsToCharsConvert string array to character array, other arrays remain unchanged
convertContainedStringsToCharsConvert an array of strings at any level of a cell array or structure {.style-list}

CHAR or STRING -convert between numeric and string

--
doubledouble precision array
stringstring array
str2doubleConvert a string to a double value
num2strConvert numbers to character arrays

Character or string -determine type and attributes {.row-span-2}

Type of data

--
ischarDetermine whether the input is a character array
iscellstrDetermines if input is a cell array of character vectors
isstringDetermine whether the input is an array of strings
isStringScalarDetermine whether the input is a string array containing one element

Text attribute

--
strlengthstring length
isstrpropDetermine which characters in the input string belong to the specified category
isletterDetermine which characters are letters
isspaceDetermine which characters are whitespace characters

character or string -find and replace {.row-span-2}

Look up

--
containsDetermine if there is a pattern in the string
matchesDetermine if a pattern matches a string
countCount the number of occurrences of a pattern in a string
endsWithDetermine if a string ends with a pattern
startsWithDetermine whether a string starts with a pattern
strfindFind a string in other strings
sscanfRead formatted data from a string

replace

--
replaceFind and replace one or more substrings
replaceBetweenReplace the substring between the start and end
strrepFind and replace substring

String matching pattern -build pattern

--
patternpattern for searching and matching text

String match pattern -character match pattern

--
alphanumericsPatternmatch alphanumeric characters
characterListPatternMatch characters in the list
digitsPatternMatch digit characters
lettersPatternmatch letter pattern
whitespacePatternmatch whitespace characters
wildcardPatternMatch as few characters of any type as possible

String matching pattern -pattern search rules

--
optionalPatternMake pattern matching optional
possessivePatternMatch pattern without backtracking
caseSensitivePatternMatch patterns in a case-sensitive manner
caseInsensitivePatternMatch patterns in a case-insensitive manner
asFewOfPatternThe number of pattern matches should be as few as possible
asManyOfPatternPattern matching as many times as possible

String matching pattern -Boundary pattern {.row-span-2}

--
alphanumericBoundaryMatches the boundary between alphanumeric and non-alphanumeric characters
digitBoundaryMatches the boundary between digit characters and non-digit characters
letterBoundaryMatches the boundary between alphabetic and non-alphabetic characters
whitespaceBoundaryMatches the boundary between whitespace and non-whitespace characters
lineBoundarymatch the beginning or end of a line
textBoundarymatch the beginning or end of the text
lookAheadBoundarymatch the boundary before the specified pattern
lookBehindBoundaryBoundary after matching the specified pattern

{.style-list}

String matching pattern -custom pattern display

--
maskedPatternpattern with specified display name
namedPatternSpecify a named pattern

String matching pattern -regular expression

--
regexpmatch regular expression (case sensitive)
regexpiMatch regular expressions (case insensitive)
regexprepReplace text using regular expressions
regexptranslateConvert text to regular expressions
regexpPatternMatch the pattern of the specified regular expression

String matching pattern -join and split

--
joinMerge strings
plusAdd numbers, append strings
splitSplit string at delimiter
splitlinesSplit a string at newlines
strjoinjoin the strings in the array
strsplitSplits a string or character vector at the specified delimiter
strtokSelected string part
extractExtract a substring from a string
extractAfterExtract the substring after the specified position
extractBeforeExtract the substring before the specified position
extractBetweenExtract the substring between the starting point and the ending point

String editing {.row-span-2}

--
eraseDelete a substring in a string
eraseBetweenDelete the substring between the start and end
extractExtract a substring from a string
extractAfterExtract the substring after the specified position
extractBeforeExtract the substring before the specified position
extractBetweenExtract the substring between the starting point and the ending point
insertAfterInsert a string after the specified substring
insertBeforeInsert a string before the specified substring
padAdd leading or trailing characters to a string
stripRemove leading and trailing characters in a string
lowerconvert string to lowercase
upperconvert string to uppercase
reverseReverse the order of characters in a string
deblankRemove trailing blanks at the end of a string
strtrimRemove leading and trailing blanks from a string
strjustalign string

String comparison

--
matchesDetermine if a pattern matches a string
strcmpCompare strings
strcmpiCompare strings (case insensitive)
strncmpcompares the first n characters of a string (case sensitive)
strncmpiCompare the first n characters of a string (case insensitive )

Basic Arithmetic {.row-span-3}

Addition

  • + Add numbers, append strings
  • sum sum of array elements
  • cumsum cumulative sum
  • movsum moving sum

{.cols-2 .marker-none}

Subtraction

  • - subtraction
  • diff difference and approximate derivative

{.cols-2 .marker-none}

Multiplication

--
.*Multiplication
*Matrix multiplication
prodproduct of array elements
cumprodcumulative product
pagemtimesMatrix multiplication by page
tensorprodTensor products between two tensors

Division

--
./Array right division
.\Array left division
/Solve the system of linear equations xA = B about x
\Solve the system of linear equations Ax = B with respect to x

Power

  • .^ Element-wise exponentiation
  • ^ matrix power

{.cols-2 .marker-none}

Transpose

--
.’Transpose a vector or matrix
complex conjugate transpose
pagetransposeTranspose by page
pagectransposeComplex conjugate transpose by page

Array notation

{.cols-2 .marker-none}

Modular division and rounding

--
modRemainder after division (modulo operation)
remRemainder after division
idivideDivisibility with rounding options
ceilround towards positive infinity
fixround towards zero
floorround towards negative infinity
roundround to the nearest decimal or integer

Custom Binary Functions

--
bsxfunApply element-wise operations on two arrays (with implicit expansion enabled)

Relational operations

value comparison

--
==Determine equality
>=Determine greater than or equal to
>Determine greater than
<=Determine less than or equal to
<Determine less than
~=Determine Inequality
isequalDetermine array equality
isequalnTest array equality, treat NaN values as equal

Logical (Boolean) operations

true or false condition

--
Short-circuit &&, ||Logical operators with short-circuit function
&Computational logic AND
~Computational logic NOT
|Calculation logic OR
xorCompute logical exclusive OR
allDetermine whether all array elements are non-zero or true
anyDetermine if any array elements are non-zero
falselogical 0 (false)
findFind the index and value of non-zero elements
islogicalDetermine whether the input is a logical array
logicalConvert numeric values to logical values
trueLogical value 1 (true)

Set operation

union, intersection, set relationship

--
intersectSet the intersection of two arrays
ismemberDetermine whether an array element is a set array member
setdiffSet the difference between two arrays
setxorSet XOR of two arrays
unionSet the union of two arrays
uniqueUnique value in an array
ismembertolset membership within tolerance
uniquetolunique values within tolerance
joinMerge two tables or timetables row by row using a key variable
innerjoinInner join between two tables or timetables
outerjoinOuter join between two tables or timetables

Bitwise operations

set, offset, or compare specific bitfields

--
bitandBitwise AND
bitorBitwise OR
bitxorBitwise XOR
bitcmpBitwise complement
bitgetGet the bit at the specified position
bitsetSet the bit at the specified position
bitshiftShift bits by specified number of bits
swapbytesswap byte order

Data import and export

text file -read and write table or timetable {.row-span-2}

Basic import and export

--
readtableCreate a table based on a file
writetablewrite table to file
readtimetableCreate a timetable based on a file
writetimetableWrite timetable to file

Define import rules

--
detectImportOptionsGenerate import options based on file content
delimitedTextImportOptionsImport options object for delimited text
fixedWidthImportOptionsImport options object for fixed-width text files
xmlImportOptionsImport options object for XML file
htmlImportOptionsImport options object for HTML files
wordDocumentImportOptionsMicrosoft Word file import options object
getvaroptsGet variable import options
setvaroptsSet variable import options
setvartypeSet variable data type
previewPreview eight lines of data in the file with import options

{.style-list}

Text files -read and write matrices and arrays

--
readmatrixRead a matrix from a file
writematrixWrite matrix to file
readcellRead a cell array from a file
writecellWrite a cell array to a file
readvarsRead variables from a file
textscanRead formatted data from a text file or string
typeDisplay file content
filereadRead file content in text format
readlinesRead lines of a file as an array of strings
writelinesWrite text to file

Spreadsheet -Read and Write Table or Timetable {.row-span-2}

Basic import and export

--
readtableCreate a table from a file
writetablewrite table to file
readtimetableCreate a timetable from a file
writetimetableWrite timetable to file
sheetnamesGet sheetnames from a spreadsheet file

{.style-list}

Define import rules

--
detectImportOptionsGenerate import options based on file content
spreadsheetImportOptionsSpreadsheet import options object
getvaroptsGet variable import options
setvaroptsSet variable import options
setvartypeSet variable data type
previewPreview eight rows of data in a file with import options

{.style-list}

Spreadsheet -Reading and writing matrices and arrays

--
readmatrixRead a matrix from a file
writematrixWrite matrix to file
readcellRead a cell array from a file
writecellWrite a cell array to a file
readvarsRead variables from a file
importdataLoad data from a file

images

--
imfinfoInformation about graphics files
imreadReads an image from a graphics file
imwriteWrites an image to a graphics file
TiffMATLAB entry for LibTIFF library routines

Read or write a NetCDF file {.row-span-2}

--
nccreateCreate variables in a NetCDF file
ncdispDisplays NetCDF data source content in the command line window
ncinfoReturns information about a NetCDF data source
ncreadRead variable data from a NetCDF data source
ncreadattRead attribute values in a NetCDF data source
ncwriteWrite data to a NetCDF file
ncwriteattWrite attributes to a NetCDF file
ncwriteschemaAdds a NetCDF schema definition to a NetCDF file

NetCDF library package -library functions

--
netcdf.getChunkCacheRetrieves the chunk cache settings for the NetCDF library
netcdf.inqLibVersReturns NetCDF library version information
netcdf.setChunkCacheSets the default chunk cache settings for the NetCDF library
netcdf.setDefaultFormatChange the default netCDF file format

{.style-list}

NetCDF library package -file operations {.row-span-2}

--
netcdf.abortrestores the most recent netCDF file definition
netcdf.closeCloses a netCDF file
netcdf.createCreate a new NetCDF dataset
netcdf.endDefEnd netCDF file definition mode
netcdf.inqreturns information about a netCDF file
netcdf.inqFormatDetermines the format of a NetCDF file
netcdf.inqGrpsRetrieves an array of subgroup IDs
netcdf.inqUnlimDimsRetrieves a list of infinite dimensions in a group
netcdf.openOpen NetCDF data source
netcdf.reDefputs an open netCDF file into definition mode
netcdf.setFillSet netCDF fill mode
netcdf.syncSynchronize netCDF files to disk

NetCDF Library Package -Dimensions

--
netcdf.defdimCreate netCDF dimensions
netcdf.inqDimReturns netCDF dimension names and lengths
netcdf.inqDimIDReturns the dimension ID
netcdf.renameDimChange netCDF dimension names

NetCDF library package -group

--
netcdf.defGrpCreate groups in a NetCDF file
netcdf.inqDimIDsRetrieves a list of dimension identifiers in a group
netcdf.inqGrpNameRetrieve group name
netcdf.inqGrpNameFullthe full pathname of the group
netcdf.inqGrpParentRetrieves the ID of the parent group.
netcdf.inqNcidReturns the ID of a named group
netcdf.inqVarIDsIDs of all variables in the group

NetCDF library package -variable {.row-span-3}

--
netcdf.defVarFillDefines the fill parameter for a NetCDF variable
netcdf.defVarCreate a NetCDF variable
netcdf.defVarChunkingDefines chunking behavior for NetCDF variables
netcdf.defVarDeflateDefines compression parameters for NetCDF variables
netcdf.defVarFletcher32Defines validation parameters for NetCDF variables
netcdf.getVarRead data in a NetCDF variable
netcdf.inqVarInformation about variables
netcdf.inqVarChunkingDetermines chunking settings for NetCDF variables
netcdf.inqVarDeflateDetermines compression settings for NetCDF variables
netcdf.inqVarFillDetermines the fill parameter value for a NetCDF variable
netcdf.inqVarFletcher32About Fletcher32 checksum settings for NetCDF variables
netcdf.inqVarIDReturns the ID associated with the variable name
netcdf.putVarWrites data to a netCDF variable
netcdf.renameVarChange netCDF variable name

{.style-list}

NetCDF library package -properties

--
netcdf.copyAttCopy an attribute to a new location
netcdf.delAttRemove netCDF attribute
netcdf.getAttReturns the NetCDF attribute
netcdf.inqAttReturns information about netCDF attributes
netcdf.inqAttIDReturns the ID of a netCDF attribute
netcdf.inqAttNameReturns the netCDF attribute name
netcdf.putAttWrite netCDF attributes
netcdf.renameAttChange Attribute Name

NetCDF library package -user-defined types

:-:-
netcdf.defVlenDefine user-defined variable length array type (NC_VLEN)
netcdf.inqUserTypeReturn information about user-defined type
netcdf.inqVlenReturn information about user-defined NC_VLEN type

{.style-list}

NetCDF library package -Utilities

--
netcdf.getConstantreturns the value of the named constant
netcdf.getConstantNamesreturns a list of constants known to the netCDF library

{.style-list}

Read or write HDF5 files

--
h5createCreate HDF5 dataset
h5dispDisplay the content of HDF5 files
h5infoInformation about HDF5 files
h5readRead data from HDF5 dataset
h5readattRead attributes from HDF5 files
h5writeWrite HDF5 dataset
h5writeattWrite HDF5 attributes

HDF5 library package {.row-span-4}

--
Library (H5)General-purpose functions for use with entire HDF5 library
Attribute (H5A)Metadata associated with datasets or groups
Dataset (H5D)Multidimensional arrays of data elements and supporting metadata
Dimension Scale (H5DS)Dimension scale associated with dataset dimensions
Error (H5E)Error handling
File (H5F)HDF5 file access
Group (H5G)Organization of objects in file
Identifier (H5I)HDF5 object identifiers
Link (H5L)Links in HDF5 file
MATLAB (H5ML)MATLAB utility functions not part of the HDF5 C library
Object (H5O)Objects in file
Property (H5P)Object property lists
Reference (H5R)HDF5 references
Dataspace (H5S)Dimensionality of dataset
Datatype (H5T)Datatype of elements in a dataset

{.style-list}

HDF4 Files -Advanced Functions

--
hdfinfoInformation about HDF4 or HDF-EOS files
hdfreadRead data from HDF4 or HDF-EOS files
imreadRead an image from a graphics file
imwriteWrite image to graphics file

Low-level functions -package {.row-span-3}

--
matlab.io.hdf4.sdInteract directly with the HDF4 multi-file scientific dataset (SD) interface
matlab.io.hdfeos.gdLow-level access to HDF-EOS grid data
matlab.io.hdfeos.swLow-level access to HDF-EOS segmented files

Low Level Functions -Functions

--
hdfanThe entry of HDF multi-file annotation (AN) interface
hdfhxThe entry of HDF external data (HX) interface
hdfhThe entry of HDF H interface
hdfhdThe entry of HDF HD interface
hdfheThe entry of HDF HE interface
hdfmlUtilities for use with MATLAB HDF entry functions
hdfptInterface of HDF-EOS point object
hdfvThe entry of HDF Vgroup (V) interface
hdfvfThe entry of VF function in HDF Vdata interface
hdfvhThe entry of VH function in HDF Vdata interface
hdfvsThe entry of VS function in HDF Vdata interface
hdfdf24HDF 24-bit raster image (DF24) interface entry
hdfdfr8HDF 8-bit raster image (DFR8) interface entry

FITS file -function

--
fitsdispDisplay FITS metadata
fitsinfoInformation about FITS files
fitsreadRead data in FITS files
fitswriteWrite image to FITS file

FITS files -file access

--
createFileCreate FITS file
openFileOpen FITS file
openDiskFileOpen FITS file
closeFileClose FITS file
deleteFileDelete FITS file
fileNameThe name of the FITS file
fileModeI/O mode for FITS files

FITS files -image processing

--
createImgCreate FITS image
getImgSizeimage size
getImgTypeThe data type of the image
insertImgInsert a FITS image after the current image
readImgread image data
setBscaleReset image scaling
writeImgwrite FITS image

FITS file -keyword {.row-span-2}

--
readCardHeader record of keywords
readKeyKeyword
readKeyCmplxA keyword in the form of a complex scalar value
readKeyDblKeyword in the form of double precision value
readKeyLongLongKeyword in the form of int64
readKeyLongStrlong string value
readKeyUnitThe physical unit string in the key
readRecordHeader record specified by number
writeCommentWrite or append COMMENT keyword to CHU
writeDateWrite DATE keyword to CHU
writeKeyUpdate or add new keywords to the current HDU
writeKeyUnitwrite physical unit string
writeHistoryWrite or append HISTORY keyword to CHU
deleteKeyDelete key by name
deleteRecordDelete keywords by record number
getHdrSpaceThe number of keywords in the header

FITS files -Header Data Unit (HDU) access

--
copyHDUCopy current HDU from one file to another
getHDUnumThe number of the current HDU in the FITS file
getHDUtypecurrent HDU type
getNumHDUsTotal number of HDUs in FITS file
movAbsHDUMove to Absolute HDU Numbering
movNamHDUMove to the first HDU containing a specific type and keyword value
movRelHDUMove relative amount of HDU from current HDU
writeChecksumCalculate and write the checksum of the current HDU
deleteHDUDelete the current HDU in the FITS file

FITS files -image compression

--
imgCompressCompress HDU from one file to another
isCompressedImgDetermine whether the current image is compressed
setCompressionTypeSet image compression type
setHCompScaleSet the scaling parameters of the HCOMPRESS algorithm
setHCompSmoothSets smoothing for images compressed with HCOMPRESS
setTileDimSet tile dimensions

FITS file -ASCII table and binary table {.row-span-3}

--
createTblCreate a new ASCII or binary table extension
insertColInsert a column into a table
insertRowsInsert rows into the table
insertATblInsert an ASCII table after the current HDU
insertBTblInsert a binary table behind the current HDU
deleteColDelete a column from a table
deleteRowsDelete rows from the table
getAColParmsASCII table information
getBColParmsbinary table information
getColNametable column name
getColTypeData type, repeat value, width of scaled column
getEqColTypecolumn data type, repeated value, width
getNumColsThe number of columns in the table
getNumRowsthe number of rows in the table
readATblHdrRead the header information from the current ASCII table
readBTblHdrRead the header information from the current binary table
readColReads rows of ASCII or binary table columns
setTscalereset image scaling
writeColWrite elements to an ASCII or binary table column

FITS files -Utilities

--
getConstantValuespecify the constant value
getVersionThe revision number of the CFITSIO library
getOpenFileslist of opened FITS files

Stripe interleaved file

--
multibandreadRead a striped interleaved file from a binary file
multibandwriteWrite strip interleaved data to a file

Common Data Format (CDF)

--
cdfinfoInformation on Common Data Format (CDF) files
cdfreadRead data in Common Data Format (CDF) files
cdfepochConverts a date literal or date sequence value to a date in CDF format
todatenumConvert CDF epoch objects to MATLAB date serial values

Bag

--
cdflibDirect interaction with CDF library

Read video data

--
VideoReaderCreate an object to read a video file
readRead one or more video frames
readFrameRead the next video frame
hasFrameDetermine whether there are video frames available for reading
getFileFormatsFile formats supported by VideoReader
mmfileinfoInformation about multimedia files

Write video data

--
VideoWriterCreate an object to write a video file
openOpen a file to write video data
writeVideoWrite video data to a file
closeclose the file after writing video data
getProfilesDescription files and file formats supported by VideoWriter

Read or write audio

--
audioreadRead audio files
audiowriteWrite audio files
lin2muConvert linear audio signal to mu-law
mu2linConvert mu-law audio signal to linear format
audioinfoInformation about audio files

Play audio

--
audioplayerObject for playing audio
isplayingDetermine whether playback is in progress
pausePause playback or recording
playPlay audio from audioplayer object
playblockingPlay audio in audioplayer object, keep control until playback is complete
resumeResume playback or recording from the paused state
stopStop playing or recording

Record audio

--
audiorecorderobject for recording audio
getaudiodataStore the recorded audio signal in a numeric array
getplayerCreate an associated audioplayer object
isrecordingDetermine if recording is in progress
recordRecord audio into audiorecorder object
recordblockingRecord audio into an audiorecorder object, keep control until recording is complete

Play sound

--
audiodevinfoInformation about audio devices
audiodevresetRefresh the list of available audio devices
soundConvert signal data matrix to sound
soundscScale data and play it as sound
beepgenerate operating system beep

Reading and writing XML documents

--
matlab.io.xml.dom.DOMWriterWrite serialized XML documents Injector
matlab.io.xml.dom.EntityResolverAbstract base class of entity resolver
matlab.io.xml.dom.FileWriterWriter for creating text files
matlab.io.xml.dom.LocatorThe location of the element in the XML file
matlab.io.xml.dom.ParserXML markup parser
matlab.io.xml.dom.ParserConfigurationXML parser options
matlab.io.xml.dom.ParseErrorSpecified XML tag parsing error
matlab.io.xml.dom.ParseErrorHandlerAbstract base class for parse error handlers
matlab.io.xml.dom.ParseErrorLocatorSpecifies location of parse error
matlab.io.xml.dom.ParseErrorSeverityIndicates the severity of XML tag parsing errors enum class
matlab.io.xml.dom.ResourceIdentifierXML resource identifier
matlab.io.xml.dom.ResourceIdentifierTypeXML resource identifier type
matlab.io.xml.dom.WriterConfigurationXML DOM Writer Options

{.style-list-arrow}

W3C DOM

--
matlab.io.xml.dom.AttrAttributes of XML elements
matlab.io.xml.dom.CDATASectionCDATA section
matlab.io.xml.dom.CommentComments in XML documents
matlab.io.xml.dom.DocumentXML document
matlab.io.xml.dom.DocumentFragmentdocument node group
matlab.io.xml.dom.DocumentTypedocument type
matlab.io.xml.dom.Elementelement of XML document
matlab.io.xml.dom.EntityEntity defined by document type
matlab.io.xml.dom.NamedNodeMapA set of document nodes with names
matlab.io.xml.dom.NodeListdocument node list
matlab.io.xml.dom.NotationNotation in document type definition
matlab.io.xml.dom.ProcessingInstructionXML processing instruction
matlab.io.xml.dom.TextText in an XML document
matlab.io.xml.dom.TypeInfoschema type information

{.style-list-arrow}

XML Transformation

--
matlab.io.xml.transform.CompiledStylesheetCompiled stylesheet
matlab.io.xml.transform.ResultDocumentStore the transformation result as a document
matlab.io.xml.transform.ResultStringStore the transformation result as a string
matlab.io.xml.transform.ResultFileStore the transformation result as a file
matlab.io.xml.transform.SourceDocumentXML source document for transformation
matlab.io.xml.transform.SourceFileXML source file for transformation
matlab.io.xml.transform.SourceStringXML source string for transformation string
matlab.io.xml.transform.StylesheetSourceDocumentStylesheet source for transformation document
matlab.io.xml.transform.StylesheetSourceFileStylesheet source for transformation document
matlab.io.xml.transform.StylesheetSourceStringXSL source string for transformation string
matlab.io.xml.transform.TracerTrace execution of stylesheet

{.style-list-arrow}

XPath query

--
matlab.io.xml.xpath.CompiledExpressionCompiled XPath expression
matlab.io.xml.xpath.EvalResultTypeThe result type of XPath expression calculation
matlab.io.xml.xpath.EvaluatorXPath expression evaluator
matlab.io.xml.xpath.PrefixResolverFor namespace prefix resolver Abstract base class for

{.style-list-arrow}

JSON format

--
jsondecodeDecode text in JSON format
jsonencodeCreate JSON-formatted text from structured MATLAB data

Workspace variables and MAT-file {.row-span-2}

--
loadLoad file variables into the workspace
saveSave workspace variables to a file
matfileAccess and change variables in a MAT-file without loading the file into memory
dispDisplay the value of the variable
formattedDisplayTextCapture display output as a string
whoList variables in the workspace
whosList variables in the workspace with their size and type
clearDelete items from the workspace and release system memory
clearvarsClear variables in memory
openvarOpen a workspace variable in the variable editor or other graphical editing tools
Workspace BrowserOpen the Workspace Browser to manage the workspace

Low-level file I/O {.row-span-2}

--
fcloseclose one or all open files
feofDetect the end of the file
ferrorFile I/O error message
fgetlRead lines in a file and remove line breaks
fgetsRead lines in a file and keep newlines
filereadRead file content in text format
fopenOpen a file or get information about opening a file
fprintfWrite data to a text file
freadRead data in binary files
frewindMove the file position indicator to the beginning of the opened file
fscanfRead the data in the text file
fseekMove to the specified position in the file
ftellcurrent location
fwriteWrite data to a binary file

Serial and USB Communication -Connection and Configuration

--
serialportlistList of serial ports connected to your system
serialportConnect to a serial port
configureTerminatorSet the terminator for ASCII string communication with the serial port
configureCallbackSet callback function and trigger conditions for communication with serial port devices

Serial and USB communication -read and write

--
readRead data from the serial port
readlineRead ASCII string data line from serial port
writewrite data to serial port
writelineWrite ASCII data line to serial port

Serial and USB communication -control pins and memory

--
flushClear the serial port device buffer
getpinstatusGet the serial port status
setRTSSet the serial port RTS pin
setDTRSet the serial DTR pin

TCP/IP communication -connection and configuration

--
tcpclientCreate a TCP/IP client connection to a TCP/IP server
echotcpipStart or stop the TCP/IP echo server
configureTerminatorSet terminator for ASCII string communication with remote host via TCP/IP
configureCallbackSet callback function and trigger condition for communication with remote host via TCP/IP

{.style-list}

TCP/IP communication -read and write

--
readRead data on a remote host via TCP/IP
readlineRead ASCII string data line from remote host via TCP/IP
writeWrite data to a remote host via TCP/IP
writelineWrite ASCII data line to remote host via TCP/IP
flushFlush buffers for communication with remote hosts via TCP/IP

{.style-list}

Bluetooth communication -connection and configuration

--
bluetoothlistScan for nearby Bluetooth classic devices
bluetoothConnect to Bluetooth classic device
configureTerminatorSet terminator for ASCII string communication with Bluetooth device
configureCallbackSet callback function and trigger condition for communication with Bluetooth device

{.style-list}

Bluetooth communication -read and write {.row-span-2}

--
readRead data from a Bluetooth device
readlineRead ASCII string data line from Bluetooth device
writewrite data to Bluetooth device
writelineWrite ASCII data line to Bluetooth device
flushClear Bluetooth device buffer

{.style-list}

Bluetooth Low Energy Communication {.row-span-2}

--
blelistScan for nearby low energy Bluetooth peripherals
bleConnect to low energy Bluetooth peripherals
characteristicAccess to characteristics of Bluetooth low energy peripherals
descriptorAccess descriptors on Bluetooth low energy peripherals
readRead characteristic or descriptor data on a Bluetooth low energy peripheral device
writeWrite data to a characteristic or descriptor of a Bluetooth low energy peripheral device
subscribeSubscribe to characteristic notifications or instructions
unsubscribeUnsubscribe characteristic notifications and instructions

{.style-list}

Web Services

--
webreadRead content from RESTful web services
webwriteWrite data to RESTful web service
websaveSave content in RESTful web service to file
weboptionsSpecify parameters for RESTful web services
webOpen a webpage or file in a browser
sendmailSend email to address list

FTP file operations {.row-span-2}

--
ftpConnect to an FTP server to access its files
sftpConnection to SFTP server to access its files
asciiSet FTP transfer mode to ASCII
binarySet FTP transfer mode to binary
cdChange or view the current folder on an SFTP or FTP server
closeClose the connection to the SFTP or FTP server
deleteDelete files on SFTP or FTP server
dirList folder contents on SFTP or FTP server
mgetDownload files from SFTP or FTP server
mkdirCreate a new folder on an SFTP or FTP server
mputUpload files or folders to SFTP or FTP server
renameRename a file on an SFTP or FTP server
rmdirDelete a folder on an SFTP or FTP server

Internet of Things (IoT) Data

--
thingSpeakReadRead data stored in ThingSpeak channel
thingSpeakWritewrite data to ThingSpeak channel