Main Content

Time

进行代码节执行时间测量的时间端(MATLAB 代码生成)

说明

示例

Time = NthSectionProfile.Time 返回时间向量,该向量对应于测量代码节执行时间的时间段。

示例

全部折叠

打开此示例以获取本教程的文件:

  • kalman01.m - 卡尔曼估计器的 MATLAB® 函数

  • test01_ui.m - 要测试 kalman01.m 的 MATLAB 文件

  • plot_trajectory.m - 绘制实际目标轨迹和卡尔曼估计器输出的文件

  • position.mat - 输入数据

openExample('ecoder/KalmanFilterExample')

设置并运行 SIL 执行。

config = coder.config('lib');
config.GenerateReport = true;

config.VerificationMode = 'SIL';
config.CodeExecutionProfiling = true;

codegen('-config', config, '-args', {zeros(2,1)}, 'kalman01');

coder.runTest('test01_ui', ['kalman01_sil.' mexext]);

执行结束时,您会看到以下消息。

To terminate execution: clear kalman01_sil
Execution profiling report available after termination.

点击链接 clear kalman01_sil

### Stopping SIL execution for 'kalman01'
    Execution profiling report: report(getCoderExecutionProfile('kalman01'))

创建一个保留执行时间数据的工作区变量。

executionProfile=getCoderExecutionProfile('kalman01');

获取第二个代码节的配置文件。

secondSectionProfile = executionProfile.Sections(2);

获取代码节的时间向量。

time = secondSectionProfile.Time;

输入参数

全部折叠

coder.profile.ExecutionTime 属性 Sections 生成的对象。

输出参量

全部折叠

对代码节进行测量的时间段(秒)。以向量形式返回。

版本历史记录

在 R2013a 中推出