Undefined function 'contains' for input arguments of type 'char'

Hi,
I am trying to use contains to check if string A has string B in it. Say, A = 'XYZXYZ', B = 'XY', I am using: tf = contains(A, B); But I keep getting error "Undefined function 'contains' for input arguments of type 'char'" Why?
Thanks in advance for any help. Jennifer

 채택된 답변

the cyclist
the cyclist 2017년 1월 23일
편집: the cyclist 2017년 1월 23일

5 개 추천

Are you using an older version of MATLAB? According to the documentation for contains, this function was introduced in version R2016b.
You might be able to use strfind instead.

댓글 수: 1

Oh, I am using 2015b. OK. I will use strfind instead. Thanks.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Geoff Hayes
Geoff Hayes 2017년 1월 23일

1 개 추천

Jennifer - which version of MATLAB are you using? According to contains, this function was introduced in R2016b.

댓글 수: 2

Thanks. I am using 2015b.
Thanks a lot Geoff. I am going to use strfind instead.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

제품

태그

질문:

JFz
2017년 1월 23일

댓글:

JFz
2017년 1월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by