Since MATLAB has been used for a long time, it was also a rookie. Recently, we have used MATLAB for a test and encountered various problems.
1: strings in MATLAB cannot be compared with =, but strcmp should be used.
= Is a comparison of one character and one character. If the character length is not equal, an error occurs, for example:
Therefore, to compare strings, use strcmp. If the string is the same, 1 is returned. If the string is different, 0 is returned.
2: simple operation
(1) concatenate strings into directories
Fullfile () is used, and the number of subsequent parameters is unlimited.
(2) load all files in a directory. Note that I starts from 3.
(3) concatenate two strings into one string
(4) structure initialization, access, and sorting
(5) the variables in Matlab are written to TXT.
<Method 1> Save 'acc.txt ''Acc'-ASCII, but the decimal point is very long (the format cannot be guaranteed). ACC is the variable name.
<Method 2>
Matlab learning notes