matlab primary

command


========

System Command

command Features Case
date Displays the current date ans = 20-Jul-2019
what The current folder file matlab  
type The contents of the file type CV.m
diary Closed / open log file Not then generate a diary
wklread Read .wkl file  

Session management command

command Explanation example
clear Clear Variable clear A; no parameters will be emptied variable space
exist Check the file or variable exists  
lookfor Search Help keyword entry  

O command

disp, fscanf, format, fprintf, input, ;
command Explanation example
%s String  
%d Integer value  
%f Float  
%e Float scientific notation  
%g The most compact format in the form  

format

short(2), long(16), + (e), bank(2), + (+, - ,0 ), rat(分数), compact(禁止一些换行符), loose(重置较为不紧凑的显示模式) 

Vector, matrix, an array of command

command Explanation example
cat Connection array cat(dim, A1, A2);%dim:维度
find Finds the index of non-zero elements
logspace Logarithmically spaced vector
reshape Change shape reshape(1:16, [4 4])
eye Matrix eye(4); eye(4, 2)
ones Array 1 ones(4)
zeros 0 array  
rand (0, 1) uniform random array  
randn (4,4) Normal random array  
cross Cross product cross ([1,1,0], [0,1,1]) % 1 -1 1
dot Dot product ab = Σ (ai * bi)
the Determinant  
inv The inverse matrix  
pinv Pseudo-inverse matrix
rank rank  
rref Into row echelon form  
cell Cell Array cell(2)?
celldisp The display unit cell array
cell plot The display unit cell array
num2cell Array ==> cell array
deal Input and output matching list
iscell Determining a cell array  

Drawing commands

command Explanation example
fplot Smart Plot
print Print the drawing to a file
axes Creating axis object
close (all) Close graph
figure Open new graphical window
gtext Enable label position by mouse
text FIG string placed
hold Freeze the current plot 非 hold on
subplot Multi-map  
refresh Redraw the current graphics window
set Object attribute axis
bar Bar chart
loglog Logging table
polar Polar coordinates
semilogx (y) Number of horizontal (vertical) coordinates
stairs Ladder
stem Figure stems

Vector splicing

水平:c = [c1, c2]; 垂直:c = [c1: c2]; 

Array Functions

function Explanation example
ndims dimension  
give name The number of elements  
blkdiag Construction diagonal matrix blk(1, 2, 3)
diag Made diagonal  
circshift Cyclic shift circshift (A, N)% N: the number of rows moved
flipdim Flip along the dimension flipdim(A, dim)
flippud Flip down  
flipplr From left to right Flip  
repmat 平铺 repmat(A, [M N])
rot90 逆时针旋转90度  

Guess you like

Origin www.cnblogs.com/hichens/p/11220419.html