Basic knowledge

Bitwise operations

set, offset, or compare specific bitfields

- - -
bitand Bitwise AND
bitor Bitwise OR
bitxor Bitwise XOR
bitcmp Bitwise complement
bitget Get the bit at the specified position
bitset Set the bit at the specified position
bitshift Shift bits by specified number of bits
swapbytes swap byte order

Set operation

union, intersection, set relationship

- - -
intersect Set the intersection of two arrays
ismember Determine whether an array element is a set array member
setdiff Set the difference between two arrays
setxor Set XOR of two arrays
union Set the union of two arrays
unique Unique value in an array
ismembertol set membership within tolerance
uniquetol unique values ​​within tolerance
join Merge two tables or timetables row by row using a key variable
innerjoin Inner join between two tables or timetables
outerjoin Outer join between two tables or timetables

Logical (Boolean) operations

true or false condition

- - -
[Short-circuit &&, ](https://www.mathworks.com/help/matlab/ref/logicaloperatorsshortcircuit.html)
& Computational logic AND
~ Computational logic NOT
[ ](https://www.mathworks.com/help/matlab/ref/or.html) Calculation logic OR
xor Compute logical exclusive OR
all Determine whether all array elements are non-zero or true
any Determine if any array elements are non-zero
false logical 0 (false)
find Find the index and value of non-zero elements
islogical Determine whether the input is a logical array
logical Convert numeric values ​​to logical values
true Logical value 1 (true)

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
isequal Determine array equality
isequaln Test array equality, treat NaN values ​​as equal

Custom Binary Functions

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

Modular division and rounding

- - -
mod Remainder after division (modulo operation)
rem Remainder after division
idivide Divisibility with rounding options
ceil round towards positive infinity
fix round towards zero
floor round towards negative infinity
round round to the nearest decimal or integer

Basic Arithmetic

#Addition

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

#Subtraction

  • - subtraction
  • diff difference and approximate derivative

#Multiplication

- - -
.* Multiplication
* Matrix multiplication
prod product of array elements
cumprod cumulative product
pagemtimes Matrix multiplication by page
tensorprod Tensor products between two tensors

#Division

- - -
./ Array right division
[.](https://www.mathworks.com/help/matlab/ref/ldivide.html) Array left division
/ Solve the system of linear equations xA = B about x
[](https://www.mathworks.com/help/matlab/ref/mldivide.html) Solve the system of linear equations Ax = B with respect to x

#Power

  • .^ Element-wise exponentiation
  • ^ matrix power

#Transpose

- - -
.' Transpose a vector or matrix
' complex conjugate transpose
pagetranspose Transpose by page
pagectranspose Complex conjugate transpose by page

#Array notation

String comparison

- - -
matches Determine if a pattern matches a string
strcmp Compare strings
strcmpi Compare strings (case insensitive)
strncmp compares the first n characters of a string (case sensitive)
strncmpi Compare the first n characters of a string (case insensitive )

String editing

- - -
erase Delete a substring in a string
eraseBetween Delete the substring between the start and end
extract Extract a substring from a string
extractAfter Extract the substring after the specified position
extractBefore Extract the substring before the specified position
extractBetween Extract the substring between the starting point and the ending point
insertAfter Insert a string after the specified substring
insertBefore Insert a string before the specified substring
pad Add leading or trailing characters to a string
strip Remove leading and trailing characters in a string
lower convert string to lowercase
upper convert string to uppercase
reverse Reverse the order of characters in a string
deblank Remove trailing blanks at the end of a string
strtrim Remove leading and trailing blanks from a string
strjust align string

String matching pattern -join and split

- - -
join Merge strings
plus Add numbers, append strings
split Split string at delimiter
splitlines Split a string at newlines
strjoin join the strings in the array
strsplit Splits a string or character vector at the specified delimiter
strtok Selected string part
extract Extract a substring from a string
extractAfter Extract the substring after the specified position
extractBefore Extract the substring before the specified position
extractBetween Extract the substring between the starting point and the ending point

String matching pattern -regular expression

- - -
regexp match regular expression (case sensitive)
regexpi Match regular expressions (case insensitive)
regexprep Replace text using regular expressions
regexptranslate Convert text to regular expressions
regexpPattern Match the pattern of the specified regular expression

String matching pattern -custom pattern display

- - -
maskedPattern pattern with specified display name
namedPattern Specify a named pattern

String matching pattern -Boundary pattern

- -
alphanumericBoundary Matches the boundary between alphanumeric and non-alphanumeric characters
digitBoundary Matches the boundary between digit characters and non-digit characters
letterBoundary Matches the boundary between alphabetic and non-alphabetic characters
whitespaceBoundary Matches the boundary between whitespace and non-whitespace characters
lineBoundary match the beginning or end of a line
textBoundary match the beginning or end of the text
lookAheadBoundary match the boundary before the specified pattern
lookBehindBoundary Boundary after matching the specified pattern

String matching pattern -pattern search rules

- - -
optionalPattern Make pattern matching optional
possessivePattern Match pattern without backtracking
caseSensitivePattern Match patterns in a case-sensitive manner
caseInsensitivePattern Match patterns in a case-insensitive manner
asFewOfPattern The number of pattern matches should be as few as possible
asManyOfPattern Pattern matching as many times as possible

String match pattern -character match pattern

- - -
alphanumericsPattern match alphanumeric characters
characterListPattern Match characters in the list
digitsPattern Match digit characters
lettersPattern match letter pattern
whitespacePattern match whitespace characters
wildcardPattern Match as few characters of any type as possible

String matching pattern -build pattern

- - -
pattern pattern for searching and matching text

character or string -find and replace

look up

- - -
contains Determine if there is a pattern in the string
matches Determine if a pattern matches a string
count Count the number of occurrences of a pattern in a string
endsWith Determine if a string ends with a pattern
startsWith Determine whether a string starts with a pattern
strfind Find a string in other strings
sscanf Read formatted data from a string
replace
- - -
--- --- ---
replace Find and replace one or more substrings
replaceBetween Replace the substring between the start and end
strrep Find and replace substring

Character or string -determine type and attributes

type of data

- - -
ischar Determine whether the input is a character array
iscellstr Determines if input is a cell array of character vectors
isstring Determine whether the input is an array of strings
isStringScalar Determine whether the input is a string array containing one element
text attribute
- - -
--- --- ---
strlength string length
isstrprop Determine which characters in the input string belong to the specified category
isletter Determine which characters are letters
isspace Determine which characters are whitespace characters

CHAR or STRING -convert between numeric and string

- - -
double double precision array
string string array
str2double Convert a string to a double value
num2str Convert numbers to character arrays

Char or string -convert input arguments

- -
convertCharsToStrings convert character array to string array, other arrays remain unchanged
convertStringsToChars Convert string array to character array, other arrays remain unchanged
convertContainedStringsToChars Convert an array of strings at any level of a cell array or structure

Character or string array

- - -
compose Format data into multiple strings
sprintf Format data as string or character vector
strcat Concatenate strings horizontally
append Merge strings

Character array

- - -
char character array
cellstr Convert to a cell array of character vectors
blanks Create a blank character array
newline Create newline

Array of strings

- - -
string string array
strings Create a string array that does not contain characters
join Merge strings
plus Add numbers, append strings

Loops and conditional statements

- -
if, elseif, else Execute statement when condition is true
switch, case, otherwise Execute one of multiple sets of statements
for A for loop used to repeat a specified number of times
while A while loop that executes repeatedly while a condition is true
try, catch Execute the statement and catch the resulting error
break Terminate execution of a for or while loop
return Return control to the calling script or function
continue Passes control to the next iteration of a for or while loop
pause Temporarily suspend the execution of MATLAB
parfor Parallel for loop
end Terminate a code block or indicate the maximum array index

Value type

Create numeric variables

- - -
double double precision array
single single precision array
int8 8-bit signed integer array
int16 16-bit signed integer array
int32 32-bit signed integer array
int64 64-bit signed integer array
uint8 Array of 8-bit unsigned integers
uint16 16-bit unsigned integer array
uint32 32-bit unsigned integer array
uint64 64-bit unsigned integer array
Convert between numeric types
- - -
--- --- ---
cast Convert variables to different data types
typecast Convert data types without changing the underlying data
query type and value
- - -
--- --- ---
allfinite Determine if all array elements are finite
anynan Determine if any array element is NaN
isinteger Determine whether the input is an integer array
isfloat Determine whether the input is a floating-point array
isnumeric Determine whether the input is a numeric array
isreal Determine whether the array uses complex storage
isfinite Determine which array elements are finite
isinf Determine which array elements are infinite
isnan Determine which array elements are NaN
Value range
- - -
--- --- ---
eps Floating point relative precision
flintmax The largest consecutive integer in floating point format
Inf Create an array with all values ​​Inf
intmax The maximum value of a specific integer type
intmin The minimum value of a specific integer type
NaN Create an array where all values ​​are NaN
realmax The largest positive floating point number
realmin Minimum standard floating point number

Input the command

- - -
ans Most recently calculated answer
clc Clear the command line window
diary Record the text of the command line window into the log file
format Set the output display format
home Send cursor reset
iskeyword Determine if the input is a MATLAB keyword
more Control paging output in the command line window
commandwindow Select command window
commandhistory Open command history window

#Objects

- -
DisplayFormatOptions Output display format in the command line window
Comments