How to make block description of a simulink function block displayed above function header?
4 次查看(过去 30 天)
显示 更早的评论
Hi everyone,
I'm using simulink function block to generate C code. For simulink function block, I add a brief function description to the block as shown below on the left side.
After code generation, the function description is inserted inside the function body.
So, I want to know if there is a way to display this description above the function header instead of inside the function body?
Thanks!
0 个评论
采纳的回答
zhichuan wang
2018-10-24
I think I get you point. You can modify the CODE TEMPLATES FILE in Configuration Parameters(Code Generation->Templates-Code templates-Source file template) to do what you want.
5 个评论
zhichuan wang
2018-10-26
Hi, qxj
I've saved your model with previous version in 2017b with the help of others. After running your model in 2017b , I found that the generated code is different from yours in 2018a, which makes me confused.
1 /*
2 * File: test_2017b_timestwo.c
3 *
4 * Code generated for Simulink model 'test_2017b'.
5 *
6 * Model version : 1.23
7 * Simulink Coder version : 8.13 (R2017b) 24-Jul-2017
8 * C/C++ source code generated on : Fri Oct 26 08:51:02 2018
9 *
10 * Target selection: ert.tlc
11 * Embedded hardware selection: Intel->x86-64 (Windows64)
12 * Code generation objectives: Unspecified
13 * Validation result: Not run
14 *
15 *
16 * TLC version : 8.13 (Jul 25 2017)
17 */
18
19 #include "test_2017b_timestwo.h"
20
21 /* Include model header file for global data */
22 #include "test_2017b.h"
23 #include "test_2017b_private.h"
24
25 /*!
26 * Function Name : test_2017b_timestwo
27 * Block Description : Block description for: '<Root>/timestwo'
28 * This function multiplies the input with two and then outputs the result as return value.
29 *
30 * Input:
31 * u: uint32
32 *
33 * Return:
34 * y: uint32
35 * Arguments : uint32_T rtu_u
36 * Return Type of Function : uint32_T
37 */
38 uint32_T test_2017b_timestwo(uint32_T rtu_u)
39 {
40 return rtu_u << 1;
41 }
42
43 /*
44 * File trailer for generated code.
45 *
46 * [EOF]
47 */
48
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!