主要内容

setFileExtension

设置 FileExtensions 中指定文件类型的文件扩展名

语法

h.setFileExtension(name,value)

说明

h.setFileExtension(name,value)coder.make.BuildTool.FileExtensions 中设置指定文件类型的扩展名值。

输入参数

全部展开

coder.make.BuildTool 对象的对象句柄,指定为变量。

示例: tool

文件类型的名称,指定为字符向量。

数据类型: char

文件扩展名的值,指定为字符向量。

数据类型: char

示例

获取默认编译工具并设置其属性

以下示例代码显示向 MATLAB® Coder™ 编译过程添加自定义工具链教程中 intel_tc.m 文件的一部分中的 setFileExtension

% ------------------------------
% 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<|');

以交互方式使用 setFileExtension

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

版本历史记录

在 R2013a 中推出