Sort usage:
B = sort (A, dim) % rearrange the elements in a along the dim direction specified in matrix.
[B, IX] = sort (a); % Where IX is an array of sizes equal to size (, each column is the replacement position mark corresponding to the element of the column vector in column.
Definition of structural variables in MATLAB:
Define structure-based variables in MATLAB and declare them as model = struct.
MATLAB time interval acquisition:
T = cputime; SURF (peaks (40); E = cputime-T
E =
0.4667
Obtain the file size in MATLAB:
% Only for one file
D = Dir ('C: \ MATLAB 6p5p1 \ work \ example. Mat ');
Sizeoffile = D. bytes
% Or u can get all mat files size's in a directory
D = Dir ('C: \ MATLAB 6p5p1 \ work \ *. Mat ');
Sizeoffile = D. bytes
D is a struct with the name, date, bytes, and isdir members.
Matlab save Function usage
Save data. Mat
For I = 1: time_seg
In (:, 1) = up (:, I );
In (:, 2) = ul (:, I );
In (:, 3) = Ut (:, I );
Tstr = ['T', int2str (I), '= in'];
Eval (tstr );
Save (['pjm _ 0102_t.mat '], ['t'num2str (I)],'-append ');
End
Random permutation Function
Randperm (n) generates a 1 ~ Random arrangement of N
Replace elements by coordinates
A = floor (lchrom * rand (1) + 1;
B = floor (lchrom * rand (1) + 1;
Minmutation = max (A, B );
Maxmutation = min (A, B );
P ([minmutation maxmutation]) = P ([maxmutation minmutation]);
Draw points and lines in two-dimensional coordinates
XY = rand (lchrom, 2) * 100
For I = 1: lchrom
Plot (XY (I, 1), XY (I, 2), 'r *');
Hold on
End
...
Draw (coordinate path, XY); % coordinate path is the vector of the specified coordinate point sequence.
Force terminate MATLAB operation
Activate command window and press Ctrl + c
Sleep in MATLAB
Pause (N), n is the number of seconds, which can be decimal places