What are the common functions of Matlab
Editor to share with you what are the common functions of Matlab, I hope you have something to gain after reading this article, let's discuss it together!
Here, as a note, record some operations that you often use but are easy to forget when using Matlab.
1. Read the alpha value of the picture
[im, ~, alpha] = imread (filename)
Note: if the file does not have a transparency attribute, the read alpha is empty
two。 Save figure Picture
Print (figure_handle, fileformat, filename)
3. Save transparent pictures
Imwrite (im, filename, 'Alpha', alpha)
4. Show transparent pictures
[im, ~, alpha] = imread ('im.png'); h = imshow (im); set
If you do not set alpha, the figure display is a white background.
5.colormap use (incompatible with C++ opencv)
Imwrite (im, colormap, filename)
6. Multiple rounding methods
Fix- rounding to zero floor- rounding to negative infinity ceil- to positive infinity round- rounding to the nearest integer, rounded
7.mask is displayed translucently on the original image.
Imshowpair (im, mask, 'blend')
8. Three-dimensional matrix
A=ones (h, w, c); for i=1:c_num A (:,:, I) = ones (h, w); end
9. Create new matrices and vectors
Zeros (m, m, n, … , classname) ones (m < n, … , classname)
Note: the data type is specified by classname. Its data type can be: duoble, single, int8, uint8, int16, uint16, int32, uint32
10. Save mat
Save (fullfile, 'variable'); after reading this article, I believe you have a certain understanding of "what are the common functions of Matlab". If you want to know more about it, welcome to follow the industry information channel, thank you for reading!