Main Content

本页采用了机器翻译。点击此处可查看英文原文。

setPostLoadFcn

类: slreq.ReqSet
命名空间: slreq

分配 PostLoadFcn 回调脚本

自 R2022a 起

语法

setPostLoadFcn(rs,callbackScript)

说明

setPostLoadFcn(rs,callbackScript)callbackScript 指定的脚本分配为需求集rsPostLoadFcn 回调脚本。

输入参数

全部展开

需求集,指定为 slreq.ReqSet 对象。

要注册为需求集的PostLoadFcn 回调的脚本的名称,指定为字符串标量或字符向量。

示例

全部展开

此示例显示如何获取和设置需求集的PostLoadFcn 回调。

将当前文件夹添加到路径中。

addpath(pwd)

打开 ShortestPath 工程。

openProject("ShortestPath");

打开shortest_path_tests_reqs需求集。需求集包含测试需求,描述了为了验证工程中的shortest_path算法必须通过测试用例测试的功能行为。

testReqs = slreq.open("shortest_path_tests_reqs");

postLoadTestReqs脚本注册为PostLoadFcn回调。

setPostLoadFcn(testReqs,"postLoadTestReqs");

确认postLoadTestReqs脚本是shortest_path_tests_reqs需求集的PostLoadFcn回调。

callbackScript = getPostLoadFcn(testReqs)
callbackScript = 
'postLoadTestReqs'

保存并关闭shortest_path_tests_reqs需求集,然后重新打开需求集。PostLoadFcn 回调会执行。

save(testReqs);
slreq.clear;
testReqs = slreq.load("shortest_path_tests_reqs");

postLoadTestReqs 脚本打开与测试需求相关的测试文件 graph_unit_tests.m 并从 myViewSettings.mat 导入需求编辑器视图设置。

type postLoadTestReqs.m
open("graph_unit_tests.m");
slreq.importViewSettings("myViewSettings.mat",1);

版本历史记录

在 R2022a 中推出