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

 Respuesta aceptada

the cyclist
the cyclist el 23 de En. de 2017
Editada: the cyclist el 23 de En. de 2017
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 comentario

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

Iniciar sesión para comentar.

Más respuestas (1)

Geoff Hayes
Geoff Hayes el 23 de En. de 2017
Jennifer - which version of MATLAB are you using? According to contains, this function was introduced in R2016b.

2 comentarios

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

Iniciar sesión para comentar.

Categorías

Más información sobre Matrices and Arrays en Centro de ayuda y File Exchange.

Productos

Etiquetas

Preguntada:

JFz
el 23 de En. de 2017

Comentada:

JFz
el 23 de En. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by