How to make block description of a simulink function block displayed above function header?
1 回表示 (過去 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!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/192404/image.png)
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!