2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
The string processing functions in MATLAB are as follows:
Function name | illustrate |
---|---|
eval(string) | As a MATLAb command evaluates a string |
blanks(n) | Returns a string with n spaces |
deblank | Remove trailing spaces from a string |
feval | Find the function value given by the string |
findstr(string) | Find a string within a string and return the position of the string (starting from 1) |
isletter | Check if a character is a letter |
isstr | Check if it is a string |
isspace | Returns true if there is space. |
iasterr | Returns the string that last generated a MATLAB error |
strcmp | String comparison function, returns true if they are the same |
strcmpi | Compare strings, taking case into account |
strrep | String Replacement Function |
strtok | Find the first token in a string |
strcat | Connection String |
strvcat | Concatenate strings vertically |
strjoin | Insert a delimiter between each string |
strsplit | Split string based on delimiter |
strfind | Finding a substring |
strmatch | Find matching strings |
strtrim | Remove leading and trailing spaces from a string |
upper | Convert to uppercase |
lower | Convert to lowercase |
String or string array construction can be achieved by directly assigning values to variables. The string content in the expression is written in single quotes. If the content contains single quotes, it needs to be escaped with two single quotes.
>>str1='I don''t konw.'
The output is:
str1 =
‘I don’t know.’
When constructing a string array, there are two forms: "[]" or "{}". If "[]" is used, the lengths of multiple strings must be the same. If "{}" is used, the lengths of multiple strings are different.Normal array or cell array。