Main Content

setFileExtension

Class: coder.make.BuildTool
Namespace: coder.make

Set file extension for named file type in FileExtensions

Syntax

h.setFileExtension(name,value)

Description

h.setFileExtension(name,value) sets the extension value of the named file type in coder.make.BuildTool.FileExtensions.

Input Arguments

expand all

Object handle for a coder.make.BuildTool object, specified as a variable.

Example: tool

Name of file type, specified as a character vector.

Data Types: char

Value of file extension, specified as a character vector.

Data Types: char

Examples

Get a Default Build Tool and Set Its Properties

The following example code shows setFileExtension in a portion of the intel_tc.m file from the Add Custom Toolchains to MATLAB® Coder™ Build Process tutorial.

% ------------------------------
% C Compiler
% ------------------------------
 
tool = tc.getBuildTool('C Compiler');

tool.setName('Intel C Compiler');
tool.setCommand('icl');
tool.setPath('');

tool.setDirective('IncludeSearchPath','-I');
tool.setDirective('PreprocessorDefine','-D');
tool.setDirective('OutputFlag','-Fo');
tool.setDirective('Debug','-Zi');

tool.setFileExtension('Source','.c');
tool.setFileExtension('Header','.h');
tool.setFileExtension('Object','.obj');

tool.setCommandPattern('|>TOOL<| |>TOOL_OPTIONS<| |>OUTPUT_FLAG<||>OUTPUT<|');

Use the setFileExtension Interactively

tc = coder.make.ToolchainInfo;
tool = tc.getBuildTool('C Compiler');
blditm = coder.make.BuildItem('CD','.cd')
bldtm = 

	Macro  : CD
	Value : .cd
tool.addFileExtension('SourceX',blditm)
value = tool.getFileExtension('SourceX')
value  = 

.cd
tool.setFileExtension('SourceX','.ef')
value = tool.getFileExtension('SourceX')
value  = 

.ef

Version History

Introduced in R2013a