Accessing M-file S-Function parameters inside TLC file

조회 수: 4 (최근 30일)
Arne
Arne 2012년 8월 1일
Hi,
I am writing a TLC file for a M-File S-Function in order to generate C-Code but I am wondering how I can access the S-Function parameters inside the TLC file.
Inside the M-File S-Function's setup(block) method I have the following:
block.NumDialogPrms = 2;
block.DialogPrmsTunable = {'Tuneable', 'Tuneable'};
which seems to work since I can access and validate the parameters also in the CheckParameters(block) function.
However, inside the TLC file's BlockInstanceSetup(block, system) function the following lines do not work:
%assign port = LibBlockParameter(P1, "", "", 0)
%assign pins = LibBlockParameter(P2, "", "", 0)
and I am wondering why.
Best regards,
Arne

채택된 답변

Kaustubha Govind
Kaustubha Govind 2012년 8월 1일
Do you call "block.AutoRegRuntimePrms({'P1','P2'});" in DoPostPropSetup? If you call block.AutoRegRuntimePrms without the parameter names, I think the default names used are MSFcnParameter, MSFcnParameter1, etc.

추가 답변 (1개)

Arne
Arne 2012년 8월 1일
편집: Arne 2012년 8월 1일
Thanks for your answer.
I fact I did not call AutoRegRuntimePrms. Now the parameters are available. Thanks!
Can I access nontuneable parameters in a similar way?
Regards, Arne
To answer my own question: WriteRTWParam() to be called in the WriteRTW callback seems to be the way to go for nontuneable parameters.
  댓글 수: 1
Kaustubha Govind
Kaustubha Govind 2012년 8월 1일
Glad you found the answer. FYI, you can type "sldemo_msfcn_frame" at the MATLAB prompt to see an example for WriteRTWParam().

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by