strcpy

Assign string value

Description

example

dest = src assigns string src to dest.

example

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

Examples

expand all

Assign string data to s1 and s2.

s1 = 'hello';
s2 = "good bye";

Assign string data to s3 and s4.

strcpy(s3,'howdy');
strcpy(s4,"so long");

Tips

  • Use in Stateflow® charts that use C as the action language.

  • Source and destination strings must refer to different symbols.

  • Enclose literal strings with single or double quotes.

Introduced in R2018b