How to get successive elements or combinations from a matrix
Taking A as an example,
there are two methods
1: Arrange the elements of A in a vertical and then horizontal manner.
2: Position the element according to the specific number of rows and columns it is in.
Example
The first method
The second method
A([1 3],[1 3])
where the previous [1 3] refers to the first and third lines, and the latter [1 3] refers to the first Column one and column three. Then take the intersection.
Replacing Entries
Change elements at certain positions in a matrix
Example:
Change the element 21 in the first row and second column of A to 76
The usage of ":"
can be used to represent the traversal of the entire row or column. Another
usage
Array Manipulation
Two matrix dot multiplication ".*"
division Dot
division "./"
corresponding position elements are still placed at the position after division.
Calculation of matrices and real numbers
Multiplication
Matrix dot multiplication ".^" constant
Related definitions of matrix
max(A): Find the maximum value of each column of the matrix.
max(max(A)): The maximum value of the entire matrix.
min (minimum) and sum (summation) are used in the same way.
Sort sort
sortrows(), according to the size of the first column, sort the entire row
find