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

8 ビュー (過去 30 日間)
JFz
JFz 2017 年 1 月 23 日
コメント済み: JFz 2017 年 1 月 23 日
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 日
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 件のコメント
JFz
JFz 2017 年 1 月 23 日
Oh, I am using 2015b. OK. I will use strfind instead. Thanks.

サインインしてコメントする。

その他の回答 (1 件)

Geoff Hayes
Geoff Hayes 2017 年 1 月 23 日
Jennifer - which version of MATLAB are you using? According to contains, this function was introduced in R2016b.
  2 件のコメント
JFz
JFz 2017 年 1 月 23 日
Thanks. I am using 2015b.
JFz
JFz 2017 年 1 月 23 日
Thanks a lot Geoff. I am going to use strfind instead.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by