I am trying to create MIL automation script using Signal Editor facing below issue.
Show older comments
1.How to access signal editor block properties using m script in MATLAB ?
2.How to import input .mat and .xlsx file and access for test manager using mscript for Signal Editor ?
Answers (1)
Tejas
on 26 Sep 2024
Hello Nikhil,
To create a MIL automation script according to the specified requirements, follow these steps:
- Access the 'Signal Editor' block using the 'set_param' function, as demonstrated in the code snippet below. Additional details about this function can be found in this documentation: https://www.mathworks.com/help/releases/R2023a/simulink/slref/set_param.html .
blockPath = [modelName '/Signal Editor'];
newSignalDataFile = 'new_signal_file.mat';
set_param(blockPath, 'Filename', newSignalDataFile);
- Import a .MAT file using the 'load' function, as shown in the code snippet below. More details about this function can be found in this documentation:https://www.mathworks.com/help/releases/R2023a/matlab/ref/load.html .
load("fileName.mat");
- Import a .XLSX file using the 'readtable' function, as illustrated in the code snippet below. More details about this function can be found in this documentation:https://www.mathworks.com/help/releases/R2023a/matlab/ref/readtable.html .
T = readtable('sample_data.xlsx','ReadRowNames',true);
- The test manager can be accessed by creating an instance of 'sltest.testmanager'. For more details on how to access functions and classes within it, as well as how to create and run test cases, refer to this documentation:https://www.mathworks.com/help/releases/R2023a/sltest/ug/create-and-run-test-cases-with-scripts.html .
Categories
Find more on Outputs in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!