Code covered by the BSD License  

Highlights from
Data converter from Simulink Design Verifier to test tool TPT

Data converter from Simulink Design Verifier to test tool TPT

by

 

Function converts Simulink Design Verifier test cases into a format that can be imported into TPT

sldv2tpt(sldvfile)
function sldv2tpt(sldvfile)
% sldv2tpt(sldvfile) converts Simulink Design Verifier test data into a TPT-readable format
% Input: sldv-file Output data file generated by Simulink Design Verifier
% Output: Testcase<n>.mat Files n=1..number of generated test cases. One file for each test case
%
% http://www.piketec.com
load(sldvfile);

for i= 1: length(sldvData.TestCases)
    for j = 1: length(sldvData.AnalysisInformation.InputPortInfo)
        uname = sldvData.AnalysisInformation.InputPortInfo{j}.SignalLabels;
        evalc(['data.', uname, ' = sldvData.TestCases(1,i).dataValues{j}']);
        data.t = sldvData.TestCases(1,i).timeValues;
        evalc(['contents.', uname, ' = data']);
        %clear data;
    end
    for j = 1: length(sldvData.AnalysisInformation.OutputPortInfo)
        uname = sldvData.AnalysisInformation.OutputPortInfo{j}.SignalLabels;
        evalc(['data.', uname, ' = sldvData.TestCases(1,i).dataValues{j}']);
        data.t = sldvData.TestCases(1,i).timeValues;
        evalc(['contents.', uname, ' = data']);
        clear data;
    end

    filename =['Testcase',num2str(i),'.mat'];
    save(filename, '-STRUCT', 'contents', '-V6', '-MAT');    
end




Contact us