Adding input data to the block parameter

1 view (last 30 days)
FURKAN TULUK
FURKAN TULUK on 12 Aug 2022
Edited: Divyam on 18 Sep 2024
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.

Answers (1)

Divyam
Divyam on 18 Sep 2024
Edited: Divyam on 18 Sep 2024
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

Community Treasure Hunt

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

Start Hunting!