Adding input data to the block parameter

1 回表示 (過去 30 日間)
FURKAN TULUK
FURKAN TULUK 2022 年 8 月 12 日
編集済み: Divyam 2024 年 9 月 18 日
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.

回答 (1 件)

Divyam
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

Community Treasure Hunt

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

Start Hunting!

Translated by