Main Content

matches

Determine if pattern matches string

Description

example

TF = matches(str,pat) returns 1 (true) if the specified pattern matches str, and returns 0 (false) otherwise.

example

TF = matches(str,pat,'IgnoreCase',true) ignores case when determining if pat matches str.

Note

Only Stateflow® charts that use MATLAB® as the action language support the matches operator.

Examples

expand all

h = "Hello, world!"
h2 = "Hello, world!"
x = matches(h, h2)

Stateflow chart that uses the lower operator in a state.

Results from stateflow chart that uses the lower operator in a state.

h = "Hello, world!"
h2 = "Hello, World!"
x = matches(h, h2, 'IgnoreCase', true)

Stateflow chart that uses the lower operator in a state.

Results from stateflow chart that uses the lower operator in a state.

Limitations

Introduced in R2021b