Search substring in character array

82 views (last 30 days)
Erik Verdijk
Erik Verdijk on 8 May 2018
Edited: Ameer Hamza on 8 May 2018
How can I find of a substring is present in a character array? The position is´t really important.

Answers (1)

Ameer Hamza
Ameer Hamza on 8 May 2018
Edited: Ameer Hamza on 8 May 2018
See strfind(). Or if position is not important then use contains().
  2 Comments
Erik Verdijk
Erik Verdijk on 8 May 2018
Undefined function 'contains' for input arguments of type 'char'. I get this error
Ameer Hamza
Ameer Hamza on 8 May 2018
Edited: Ameer Hamza on 8 May 2018
contains() was introduced in R2016b. Which MATLAB version are you using?

Sign in to comment.

Categories

Find more on Characters and Strings in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!