Relative/ Absolute path in Baseline Text

4 ビュー (過去 30 日間)
Saurabh Dhakate
Saurabh Dhakate 2024 年 7 月 16 日
コメント済み: Saurabh Dhakate 2024 年 7 月 17 日
Is it possible to use relative path instead of absolute when adding baseline criteria?

採用された回答

Gayatri
Gayatri 2024 年 7 月 16 日
Hi Saurabh,
One way to handle this is by leveraging the ‘preLoadFcn’ property of your test cases.
1. Create a Preload Function: Write a function that calculates the path to your MAT file relative to the common base directory and sets this path in a way that your test can use it.
function preloadFunction(testCase)
% Example of setting a relative path for a MAT file
basePath = fileparts(which('yourTestFile.m'));
relativePathToMat = fullfile(basePath, 'relative', 'path', 'to', 'yourMatFile.mat');
testCase.TestData.matFilePath = relativePathToMat;
end
2. Configure Your Test to Use the Preload Function: In the Test Manager or your test script, set the ‘preLoadFcn’ property of your test case to point to the preload function you just created.
Please refer the below documentation for ‘preLoadFcn’ property: https://www.mathworks.com/help/simulink/ug/model-callbacks.html
I Hope it helps!
  1 件のコメント
Saurabh Dhakate
Saurabh Dhakate 2024 年 7 月 17 日
Thanks for your response, It worked for me.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTesting Frameworks についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by