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!