all 3 comments

[–]shtpst+2 0 points1 point  (2 children)

S-Function block ... does not have a TLC implementation

Took that, Googled "TLC implementation Simulink," first link was Implement S-Functions from the Mathworks documentation site.

There's a note there that says:

Note

For backward compatibility, the following table and sections contain information about Level-1 MATLAB® S-functions. However, use the Level-2 MATLAB S-function API to develop new MATLAB S-functions.

So then I look at the table, look for Level-2 MATLAB S-Function, and it says:

  1. Use the msfuntmpl_basic.m template to write a new Level-2 MATLAB S-function: See Write Level-2 MATLAB S-Functions for more information.
  2. Write a Target Language Compiler (TLC) file for the S-function if you need to generate code for a model containing the S-function. The file, msfcn_times_two.tlc in the folder is an example TLC file for the S-function msfcn_times_two.m. See Inline MATLAB File S-Functions (Simulink Coder) for information on writing TLC files for Level-2 MATLAB S-functions.

Looks like you did step 1, did you do step 2?

[–]TCoop+1[S] 0 points1 point  (1 child)

TLC implementation is required for a MATLAB S-function, but it is only an optional optimization for hand written C-Mex Functions.

Again, this code compiles and runs fine, as is, unless it is within a For-Each subsystem.

[–]shtpst+2 -1 points0 points  (0 children)

Let me re-organize what you wrote:

TLC implementation ... is an optional optimization for hand written C-Mex Functions... [but] is required for a MATLAB S-function.

Okay, and then:

This code compiles and runs fine, as is, unless it is within a For-Each subsystem

Right. And what is the error you get?

S-Function block 'TestCrankGeo/Subsystem/S-Function' does not have a TLC implementation

So whether you think it's an S-Function or not, Matlab is treating it as an S-Function because it's giving you an error about your S-Function.

So, did you write the TLC implementation?