String Compare

Compare two input strings

  • Library:
  • Simulink / String

  • String Compare block

Description

String Compare compares two strings. To see if two strings are identical, use this block. You can specify if the match is case sensitive and how much of the string to compare.

Ports

Input

expand all

First string to compare, specified as a scalar.

Data Types: string

Second string to compare, specified as a scalar.

Data Types: string

Output

expand all

True or false result, specified as a scalar:

  • 1 — Match.

  • 0 — No match.

Data Types: Boolean

Parameters

expand all

Case sensitivity for string comparison:

on

Consider string case when comparing strings.

off

Do not consider string case when comparing strings.

Amount of string to compare:

  • Entire string — Compare both entire strings.

  • First N characters — Compare the first N characters of both strings.

Dependencies

Setting this parameter to First N characters enables the Number of characters parameter.

Number of characters to compare

Dependencies

This parameter is enabled when the Compare Option parameter is set to First N characters.

Data Types: double

Block Characteristics

Data Types

Boolean | string

Direct Feedthrough

yes

Multidimensional Signals

no

Variable-Size Signals

no

Zero-Crossing Detection

no

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Introduced in R2018a