Main Content

strcpy

Assign string value

Description

str1 = str2 assigns string str1 to string str2.

example

strcpy(str1,str2) is an alternative way to execute str1 = str2.

example

Note

The operator strcpy is supported only in Stateflow® charts that use C as the action language.

Examples

expand all

Assign string data to str1 and str2.

str1 = 'So Long';
str2 = "Farewell";

Stateflow chart that uses the strcpy operator in a state.

Alternatively, in charts that use C as the action language, you can use strcpy to assign string data.

strcpy(str3,'Auf Wiedersehen');
strcpy(str4,"Adieu");

Stateflow chart that uses the strcpy operator in a state.

Tips

  • Source and destination arguments must refer to different symbols.

  • Enclose literal strings with single or double quotes.

Version History

Introduced in R2018b