Main Content

String Data

Text-based values

Strings are pieces of textual data. Use strings in Stateflow® charts to control chart behavior or create natural language output. Incorporate string data in your logging, messages, and custom code workflows.

Stateflow Syntax

expand all

Create, Concatenate, and Convert

stringConvert value to string in Stateflow chart
blanksCharacter array of spaces
plusConcatenate strings in Stateflow chart
str2doubleConvert string to double-precision value in Stateflow chart

Determine Types and Properties

isletterDetermine which characters are letters in Stateflow chart
isspaceDetermine which characters are spaces in Stateflow chart
isstringDetermine if input is string in Stateflow chart
strlengthDetermine length of string in Stateflow chart

Find and Replace

containsDetermine if string contains substring in Stateflow chart
startsWithDetermine if string starts with substring in Stateflow chart
endsWithDetermine if string ends with substring in Stateflow chart
strfindFind substring within a string in Stateflow chart
extractAfterExtract substring after position in Stateflow chart
extractBeforeExtract substring before position in Stateflow chart
replaceFind and replace substrings in Stateflow chart
replaceBetweenReplace substrings between start and end points in Stateflow chart
strrepFind and replace substrings in Stateflow chart
eraseDelete substrings within strings in Stateflow chart
eraseBetweenDelete substring between start and end points in Stateflow chart
insertAfterInsert string after substring in Stateflow chart
insertBeforeInsert string before substring in Stateflow chart

Edit

lowerConvert string to lowercase in Stateflow chart
upperConvert a string to uppercase in Stateflow chart
reverseReverse order of characters in strings in Stateflow chart
stripRemove leading and trailing characters from string in Stateflow chart
strtrimRemove leading and trailing white space from string in Stateflow chart

Compare

matchesDetermine if two strings match in Stateflow chart
strcmpCompare strings in Stateflow chart (case sensitive)
strcmpiCompare strings in Stateflow chart (case insensitive)
strncmpCompare first N characters of strings in Stateflow chart (case sensitive)
strncmpiCompare first N characters of strings in Stateflow chart (case insensitive)
ascii2strConvert array of type uint8 to string
str2asciiConvert string to array of type uint8
str2doubleConvert string to double-precision value in Stateflow chart
strcatConcatenate strings
strcmpCompare strings in Stateflow chart (case sensitive)
strcpyAssign string value
strlenDetermine length of string
substrExtract substring from string
tostringConvert value to string

Topics