Easy to forget small knowledge points:
matlab Program Wrapping (a space plus 3.) And then go straight to the next line to continue writing the code)
MATLAB under the program timing
as follows: Tic and TOC can be used in the program more than one, calculate the run time of each program block. You can also nest using ...
tic;% Timing starts%%%%%%%%%%% program%%%%%%%%%%%toc;% Timing Ends
Tic and TOC can be nested to use, are looking for the nearest TOC always look for the nearest tic, similar to if end of the mate, if want to direct output run time, as long as the disp ([' Copy redundant data to spend time: ', Num2str (TOC)]);
MATLAB query data type
Class
String manipulation:
Compares two strings for equality:
Strcmpi:
Compare strings (case insensitive)
Strcmpi (' Yes ', ' No ')
Ans =
0
Strcmpi (' yes ', ' yes ')
Ans =
1
strcmp
Compare strings (case sensitive)
strcmp (' Yes ', ' No ')
Ans =
0
strcmp (' yes ', ' yes ')
Ans =
1
Merging strings:
Strcat
Description
Combinedstr = strcat (S1, S2, ..., sn) horizontally concatenates strings in arrays s1, S2, ..., SN. Inputs can combinations of single strings, strings in scalar cells, character arrays with the same number of rows, and same-sized cell arrays of strings. If any input was a cell array, COMBINEDSTR is a cell array of strings. Otherwise, Combinedstr is a character array.
A = {' ABCDE ', ' Fghi '};
b = {' JKL ', ' mn '};
AB = Strcat (A, B)
Matlab®returns
AB =
' Abcdejkl ' fghimn '
The initial feeling of this function is similar to [], but after looking at the description to know that the function is more widely used, after all, the brackets [], can only merge a line of string, function strcat can handle multiple rows of array, cell, string.
Array operations:
Determine if the array is empty:
IsEmpty (a): Returns logical 1 (TRUE) if array A is empty, otherwise returns logical 0 (FALSE). This function is often used in conjunction with the rest of the functions (to handle the return value of other functions), and is added after the if to the judgment function
To find the array mean:
Mean: The default is 1, which is calculated by column.
Entire block copy array:
Repmat (a,m,n): Expands m times by row, expands n times by column
Take random number:
To take a random arrangement:
Randperm:
Syntax
p = randperm (n)
p = randperm (n,k)
Description
p = randperm (n) returns a row vector containing randomly arranged integers from 1 to n
p = randperm (n,k) returns a row vector containing K unique integers from 1 to n randomly arranged integers
Data type conversions:
data to Integer type:(Signed) (unsigned)
Image display:
change the imshow out of the digital title of the picture, for the information you want , so that when displaying a large number of pictures at the same time, easy to understand the picture information.
figure;imshow (FRAMESAMP1); Set (GCF,'numbertitle','off'); Set (GCF,'Name',' read the first frame in the video ');
Change the first frame of the video read above into the kanji you want.
picture with larger size imshow(similar to above, add the following statement after Imshow)
Set (GCF,'outerposition',get(0,'screensize') );% this should be the meaning of full-screen display
The above two can be used together
Imwrite the image to the specified folder , as below, directly enclose the complete absolute path containing the file name in brackets [].
Tempblack is a picture, followed by [] contains the absolute path plus the file name
Imwrite (tempblack,[savepathno1,savepathno2{1},'\ ', savepathno3{i+1},'\' , Savenameno1{font},num2str (videoCount-2), ... Savenameno2{type},num2str (i),'Black', Num2str (j),'. jpg' ]);
To display multiple sub-graphs in a picture:
Figure;subplot (2,3,1), Imshow (Samppic), subplot (2,3,2), Imshow (Tempblack), subplot (2,3,3), Imshow (TempWhite); Subplot (2,3,4), Imshow (Tempbitblack), subplot (2,3,5), Imshow (Tempbitwhite), set (GCF, ' numbertitle ', ' off '), set (GCF, ' Name ', ' intercept a small chunk of transformation ');
Subplot with title
1 Figure ;2Subplot (2,3,1), Imshow (F1);3Title'Original picture');4Subplot (2,3,2), Imshow (F2);5Title'the picture to be reduced');6Subplot (2,3,3), Imshow (F3);7Title'difference Picture');8 9F31=F3 (:,:,1);TenSubplot (2,3,4), Imshow (f31); OneTitle'difference Picture First dimension'); AF32=F3 (:,:,2); -Subplot (2,3,5), Imshow (F32); -Title'difference Picture Second dimension'); theF33=F3 (:,:,3); -Subplot (2,3,6), Imshow (F33); -Title'difference Picture Third dimension'); - + Set(GCF,'Numbertitle','off'); - Set(GCF,'Name','all the data show');
Gui:
Modify the already generated fig
Enter guide in the Command window and select existing Fig
New GUI Open existing GUI
The callback of each control is appended with Guidata (hobject,handles), which means that all the contents of the control are saved, which is convenient for other control calls. Add handles = Guidata (hobject) before other controls, and you can call other functions
GUI: Functions
Opens the specified file
[Handles. Filename,pathname] = uigetfile ('*.jpg','Select the jpg file', ' d:\ '); % handles. FileName is the filename % pathname is the path % default open jpg format picture % text box appears as select the jpg file% open path to D drive by default
displays text in the interface.
Select the static Text, and then the corresponding tag
Set (handles.text11,'String', [Pathname,picturenamelist (pictureno+2). name]);% Displays the full absolute file name of the currently displayed picture in the interface
The following is a string on the line [Pathname,picturenamelist (pictureno+2). Name]
MATLAB Programming Knowledge points