document generated code with simulink report generator -凯发k8网页登录

main content

document generated code with simulink report generator

the simulink® report generator™ software creates documentation from your model in multiple formats, including html, pdf, rtf, microsoft word, and xml. this example shows one way to document a code generation project in microsoft® word. the generated report includes:

  • system snapshots (model and subsystem diagrams)

  • block execution order list

  • simulink coder™ and model version information for generated code

  • list of generated files

  • optimization configuration parameter settings

  • system target file selection and build process configuration parameter settings

  • subsystem map

  • file name, path, and generated code listings for the source code

to adjust simulink report generator settings to include custom code and then generate a report for a model, complete the following tasks:

a simulink report generator license is required for the following report formats: pdf, rtf, microsoft word, and xml. for more information on generating reports in these formats, see the simulink report generator documentation.

generate code for the model

before you use the report generator to document your project, generate code for the model.

  1. in the matlab® current folder browser, navigate to a folder where you have write access.

  2. create a working folder from the matlab command line by typing:

    mkdir report_ex
  3. make report_ex your working folder:

    cd report_ex
  4. open the slexaircraftexample model. in the command window, enter:

    openexample('slexaircraftexample')
  5. on the simulation tab, in the save list, select save as. navigate to the working folder, report_ex, and save a copy of the slexaircraftexample model as mymodel.

  6. open the configuration parameters dialog box. set the solver > solver selection > type parameter to fixed-step.

  7. select the code generation pane. select generate code only.

  8. click apply.

  9. in the model window, press ctrl b. the build process generates code for the model.

open the report generator

after you generate the code, open the report generator.

  1. open the report generator app. in the model diagram window, in the apps gallery, click report generator.

  2. in the report explorer window, in the options pane (center), click the folder rtw (\toolbox\rtw). click the setup file that it contains, codegen.rpt.

    report explorer dialog box. the setup file codegen.rpt is selected in the center pane. the right pane shows a description of the file and action buttons to open the report or generate a report.

  3. double-click codegen.rpt or select it and click the open report button. the report explorer displays the structure of the setup file in the outline pane (left).

    report explorer dialog box. on the left pane, the report codegen.rpt is selected and expanded to show the outline of the report.

set report name, location, and format

before generating a report, you can specify report output options, such as the folder, file name, and format. for example, to generate a microsoft word report named mycgmodelreport.rtf:

  1. in the properties pane, under report options, review the options listed.

    report explorer dialog box. on the left pane, the report codegen.rpt is selected. the report options pane to the right shows options for the report.

  2. leave the directory field set to present working directory.

  3. for filename, select custom: and replace index with the name mymodelcgreport.

  4. for file format, specify rich text format and replace standard print with numbered chapters & sections.

include models and subsystems in a report

specify the models and subsystems that you want to include in the generated report by setting options in the model loop component.

  1. in the outline pane (left), select model loop. report generator displays model loop component options in the properties pane.

  2. if not already selected, select current block diagram for the model name option.

  3. in the outline pane, click report - codegen.rpt*.

    report explorer dialog box. in the left pane, the report codegen.rpt is selected.

customize the report

after specifying the models and subsystems to include in the report, you can customize the sections included in the report.

  1. in the outline pane (left), expand the node chapter - generated code. by default, the report includes two sections, each containing one of two report components.

  2. expand the node section 1 — code generation summary.

  3. select code generation summary. options for the component are displayed in the properties pane.

  4. click help to review the report customizations that you can make with the code generation summary component. for this example, do not customize the component.

  5. in the report explorer window, expand the node section 1 — generated code listing.

  6. select import generated code. options for the component are displayed in the properties pane.

  7. click help to review the report customizations that you can make with the import generated code component.

generate the report

after you adjust the report options, from the report explorer window, generate the report by clicking file > report. a message list dialog box opens, which displays messages that you can monitor as the report is generated. model snapshots also appear during report generation. the message list dialog box might be hidden behind other dialog boxes.

message list dialog box showing messages from report generation. messages show the beginning of report generation, looping on the model and systems, converting the report, and completing the report.

when the report is complete, open the report, mymodelcgreport.rtf in the folder report_ex (in this example).

related topics

网站地图