Target Language Compiler    

Scalar or Vector, It's the Same

Suppose your model's input signal was a vector instead of a scalar. How would TLC handle it when producing inline code? Explore how signal vectorization works through the following exercise:

  1. Open the model sfun_x2v.mdl that is in your working directory. This model is just a vectored version of sfun_x2.mdl, in which the sinewave source produces a vector of signals of width 4. It does not use inline parameters.
  2. Activate the Scope block and run the simulation. Note that vector output is produced.
  3. Build a stand-alone version of sfun_x2v.mdl. Run the executable that is produced and view its output in the MATLAB workspace.
  4. Inspect the source code TLC produces (sfun_x2v.c), comparing it to sfun_x2.c. Note how the TLC implemented vector input without any changes having to be made to timestwo.tlc.
  5. Close both models (sfun_x2 and sfun_x2v) before continuing with the tutorial.

  Creating an Inlined S-Function Exploring Variable Names and Loop Rolling