Adding input data to the block parameter
1 次查看(过去 30 天)
显示 更早的评论
Hello,
I want to take window length parameter in Moving Average Filter Block in Simulink as data input. Because I want to take the window length as a parameter in the code I created in the microcontroller using the embedded coder. How can I do that?
Sincerely.
0 个评论
回答(1 个)
Divyam
2024-9-18
编辑:Divyam
2024-9-18
The "coder.Constant" class can be used in this case to specify the constant input value for code generation.
While generating your C code for the constant window length parameter with value 20 you can execute the following code:
codegen <function name> -config <code configuration> -args {coder.Constant(20)}
For more information regarding the use of "coder.Constant" class for C code generation, refer to this documentation: https://www.mathworks.com/help/coder/ref/coder.constant-class.html?s_tid=doc_ta#:~:text=Generate%20C%20Code%20from%20a%20MATLAB%20Function%20That%20Has%20Constant%20Input
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!