matlab how the search string with strfind in cellular array () and findstr () different (recommended!)

Copyright: Reprinted indicate the source https://blog.csdn.net/qq_43157190/article/details/89401257

We know that for a matching string in the string may be strfind () and the findstr () two functions, but by xlsread function derived from the cellular data in Excel, so that the function can not be used strfind, in this case there are two ways.


1, with isMember () function that takes two arguments index = ismember (a, b), b can be determined whether an element of a. index returns the location index is located


2, with the index = find (strcmp (a, b)), such a function can find the index combination. strcmp returns a cellular logic arrays with dimensions sized, non-zero elements found by the array find, which is thought to achieve its.


Here Insert Picture Description
But ismember () to use a wide range of some, relatively speaking, more than is necessary to spend some time, if you just need to find a string, it is recommended to use the second method, more efficient.

Guess you like

Origin blog.csdn.net/qq_43157190/article/details/89401257