1: Find the number of rows nrow=size (matrix,1);
2: The number of columns ncol=size (matrix,2);
3: Matrix merge c1=[m1,m2] horizontal merge c2=[m1;m2] vertical merge
m1= [5 2 3]; M2=[1 2 3];
C1 =[5 2 3 1 2 3];
C2 =[
5 2 3
1 2 3
]
MATLAB subscript starting from 1, take the elements of Matlab directly with M[index] can
Take a sub-matrix
M[r1:rn,:] R1-rn row, all columns
M[:,C1-CN] C1-CN column, all rows
Number of elements in the statistical matrix that are equal to Q (ii)
OO (1,ii) =length (Find (H (:, i+1) ==q (ii));
4: Matrix transpose transpose (matrix) matrix ';
Matalab Logic Judgment
<, <=, >, >=, = =, ~=, &, |, ~
Decimal rounding
Ound (x): rounded to nearest integer
Fix (x): the decimal to the nearest integer, whether positive or negative
Floor (x): Rounding down, that is, rounding the positive decimal to the nearest integer
Ceil (x): Rounding up, that is, adding positive decimals to the nearest integer
Matlab sorting by rows
Sortrows (M, nrow);
Sortcols (M,ncol);
matlab Matrix Establishment : http://www.cnblogs.com/whxiyi/archive/2009/12/08/1619500.html
Diagonal matrix eye (n);
Empty Matrix []
Nan (' Double ') is the same as Nan with no parameters. Nan (' single ') is an Nannan (n) of the mono-precision expression (representation) that returns a n*n-composed matrix of Nan. Nan (m,n) or Nan ([m,n]) returns a m*n matrix that is composed of Nan.
MATLAB matrix operations
A (:, j) denotes column J of Matrix A
A (i,:) Represents the line I of matrix A
A+b: Matrix addition
A-B: Matrix subtraction
A*b: Matrix multiplication
a\b: Left divide of Matrix
A/b: right-of-matrix removal
Transpose (m) or M ' Matrix transpose
A (:, j) denotes column J of Matrix A.
A (i,:) Represents the line I of matrix A.
A (I,J) represents the first row of column J of the matrix A element.
A (i) represents the first element of matrix A (:).
Each element of the m.^2 matrix is evaluated two times
Logical judgment
while (Iter<iter_max) && (Err>err_max)
MATLAB matrix operations