strcpy

Assign string value

Description

example

strcpy(dest,src) assigns string src to dest.

example

dest = src is an alternative way to execute strcpy(dest,src).

Note

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

Examples

expand all

Assign string data to s1, s2, and s3.

strcpy(s1,'So long');
strcpy(s2,"Farewell");
strcpy(s3,s2);

Stateflow chart that uses the strcpy operator in a state.

Assign string data to s4, s5, and s6.

s4 = 'Auf Wiedersehen';
s5 = "Adieu";
s6 = s4;

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.

Introduced in R2018b