Technical data
2
Working with the Target Language
2-44
The scoping rules within functions behave differently. A function has its own
scope, and that scope gets added to the previously described list as depicted in
this figure.
Figure 2-6: Scoping Rules Within Functions
Target Language Functions
The target language function construct is:
%function identifier ( optional-arguments ) [Output | void]
%return
%endfunction
Functions in the target language are recursive and have their own local
variable space. Target language functions do not produce any output, unless
they explicitly use the
%openfile, %selectfile, and %closefile directives, or
are output functions.
Global Pool
%assign a = …
%assign b = …
…
Top-Level RTW Pool
CompiledModel {
…
}
%with CompiledModel.
System[Sysidx]
2
3
4
1
%function function(…)
foo (x,y)