필터 지우기
필터 지우기

Editing Code Generation Template When Using MATLAB Coder

조회 수: 11 (최근 30일)
Marc Easton
Marc Easton 2017년 7월 21일
댓글: Andy 2017년 7월 24일
I'm trying to add a static char to all of the code generation done using MATLAB coder. I can accomplish this in Simulink by editing the ert_code_template.cgt file, but I can't figure out how to accomplish this using the MATLAB coder. Is there a code template file similar to the ert_code_template.cgt that I can edit? This is an example of how I've edited the ert_code_template.cgt:
%% Code insertion section (required)
%% These are required tokens. You can insert comments and other tokens in
%% between them, but do not change their order or remove them.
%%
#ifndef RTW_SOURCE_TIMESTAMP_
#define RTW_SOURCE_TIMESTAMP_
static char source_generated_on_timestamp[] = "%<SourceGeneratedOn>";
#endif
%<Includes>
%<Defines>
%<Types>
%<Enums>
%<Definitions>
%<Declarations>
%<Functions>
  댓글 수: 1
Andy
Andy 2017년 7월 24일
Hi Marc, you should be able to use the following commands to use a code generation template for codegen:
cfgObj = coder.config(lib,ecoder,true); % Create an E-coder config object
CGTFile = myCGTFile.cgt; % Specify the custom CGT File
cfgObj.CodeTemplate = coder.MATLABCodeTemplate(CGTFile); % Use custom template
codegen –config cfgObj myFile
See https://www.mathworks.com/help/ecoder/ug/code-generation-template-cgt-files-for-matlab-code-generation.html for more information.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Code Appearance에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by