If you are looking to directly utilize the output from an S-Function block within a TLC (Target Language Compiler) file, you can streamline this process by writing your algorithm in a C file. This approach involves creating a wrapper S-Function that calls your algorithm, thereby minimizing the overhead typically associated with S-Functions.
At the top of your TLC file, specify the implementation of your algorithm using the "%implements" directive.
%implements "my_alg" "C"
This line tells the TLC file to use the C implementation of your algorithm named "my_alg".
You can then call your algorithm directly within the "Outputs" function of the TLC file. Here’s an example of how to set this up:
%function Outputs(block, system) Output
%assign outPtr = LibBlockOutputSignalAddr(0, "", "", 0)
%assign inPtr = LibBlockInputSignalAddr(0, "", "",0)
%assign numEls = LibBlockOutputSignalWidth(0)
my_alg(%<inPtr>,%<outPtr>,%<numEls>);
%endfunction
You can learn more about writing wrapped inline S-Function using TLC from the documentation linked below.