LibSystemOutputCustomCode() return function inlining error
4 views (last 30 days)
Show older comments
Hi,
I am aiming to insert a custom code at the begining of model_step()function in an ert system with CodeFormat as "Embedded-C"
for example;
/* Model step function */
void ARM_R5_step(void)
{
----> /* Here I want to Insert my code */
boolean_T rtb_equal_to_count;
/* Sum: '<S1>/Sum' incorporates:
* Constant: '<S1>/INC'
* UnitDelay: '<S1>/X'
*/
/* End of Switch: '<S1>/Switch' */
}
and I have my custom_file_process.tlc file as follow;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Abstract:
%% Example Embedded Coder custom file processing template.
%%
%% Note: This file can contain any valid TLC code, which Embedded Coder
%% executes just prior to writing the generated source files to disk.
%% Using this template "hook" file, you are able to augment the generated
%% source code and create additional files.
%%
%% Copyright 1994-2021 The MathWorks, Inc.
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%selectfile NULL_FILE
%% Uncomment this TLC line to execute the example
%% || ||
%% || ||
%% \/ \/
%assign ERTCustomFileTest = TLC_TRUE
%if EXISTS(ERTCustomFileTest) && ERTCustomFileTest == TLC_TRUE
%assign ss = CompiledModel.System[GetBaseSystemIdx()]
%assign CombineOutputUpdateFcns = 1
%openfile tmpBuf
/************************************/
/*** Custom code from TLC ***/
/************************************/
%closefile tmpBuf
%<LibSystemOutputCustomCode(ss,tmpBuf,"declaration")>
%endif
but this result an error shown below,
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1502844/image.png)
My question is,
Do you think I'm using the LibSystemOutputCustomCode() function correctly?
Is there another way I could approach this instead of using the LibSystemOutputCustomCode() function?
0 Comments
Answers (1)
Mark McBroom
on 12 Oct 2023
This block should allow you to insert code into the step() function: https://www.mathworks.com/help/ecoder/ref/systemupdate.html
See Also
Categories
Find more on Target Language Compiler in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!