Get Parameter Value from Masked Block in TLC code

4 views (last 30 days)
Hello all,
I want to get a "setPort" variable from a masked "MyFunction" block by using LibBlockParameter function, but it did not work.
This is my code :
%assign u = LibBlockParameter(block.Identifier.MyFunction, "", "", 0)
%<block.RTWdata.port> = %u;
Please give me some advices. Thanks so much !
  7 Comments
Benjamin Thompson
Benjamin Thompson on 16 Jan 2024
Please attach sample files that demonstrate your problem. There should be a Simulink model file SLX, a C or C++ file for the S-Function, and attach the TLC file for how to code generate the S-Function. Attach any output that you get when you are trying to code generate this model.
See the documentation on ssSetNumRunTimeParams, you probably need to be calling that in the S-Function C/C++ code. See documentation on ssSetNumSFcnParams.
See documentation on ssWriteRTWParameters and the mdlRTW function for writing parameter values given to the S-Function MEX out to the model RTW file during code generation.

Sign in to comment.

Answers (0)

Categories

Find more on Block and Blockset Authoring in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!