フィルターのクリア

Custom criteria in Test Manager- Is there any way to get signal by name?

3 ビュー (過去 30 日間)
Varunjith Vijayan
Varunjith Vijayan 2018 年 4 月 26 日
回答済み: Mark McBroom 2018 年 4 月 28 日
Now I am using the following code. In the following code I am using the index for getting the signal. Is there any method to get the index number or get signal by name? I have around 40 signals and the signal that I am checking at index 30. If I log more signals the index is changing. Is there any method to get the index number or get signal by name?
% Get the output Simulink.sdi.Run object
outobj = test.TestResult.getOutputRuns;
%Get object of type Simulink.sdi.Signal
sig = outobj.getSignalByIndex(1);
% return a struct containing data
data = sig.dataValues; % Contains both data and the time
assert(data.Data(end) == Test_Sequence1_Active_Step_Enum.Finish, 'Test Failed after %d seconds, last step in Test Sequence is : %s ',data.Time(end), data.Data(end));

採用された回答

Mark McBroom
Mark McBroom 2018 年 4 月 28 日
I think you will have to loop through all signals in the run and look at property sig.Name to find the signal name of interest. outobj.signalCount will tell you the total number of signals in the run and would be the upper bound of your loop.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResults, Reporting, and Test File Management についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by