The MAT-File test vector offers an easy way for you to use data from a MAT-file in the SystemTest™ software.
To add a test vector:
Click the New button in the Test Vectors pane.
In the Insert New Test Vector dialog box, select the test vector type of MAT-File.
The red border indicating that the element is in an error state is normal, and will go away once you add file(s) in step 4.
Assign a name to the vector in the Name field.
Click the Add File(s) button.
In the Select MAT-File dialog box, browse for your MAT-file(s). You can select multiple files at the same time. Only MAT-files can be added. Other file types produce an error. After selecting the file(s), click the Open button to bring them into the test vector.
In the MAT-Files to read table on the General tab, MAT-files that are checked will be used in the test. Unchecking a file means it will not be included in the test.
Click the Variables tab. All the common variables contained in all the selected MAT-file(s) you added appear in the table.
Note that the variables are sorted in alphabetical order. If you have multiple MAT-files, only variables that are common across all files appear in the table.
Variables that are checked will be used in the test. Unchecking a variable means it will not be included in the test. In the example above, all variables except for ans will be used in the test.
Checking or unchecking the checkbox in the table header will select or unselect all variables. It is a Select All/Unselect All toggle option.
MAT-File test vectors are ungrouped by default. On the Grouping tab, you can select the Assign test vector to a group option if you want to group the test vector.
Grouping test vectors is useful for reducing the number of iterations to execute. It means that the SystemTest software will sequentially combine values for all grouped test vectors, instead of permuting their values. See Grouped Test Vectors for more information on grouped test vectors.
Click OK in the Insert Test Vector dialog box.
The new vector appears in the Test Vectors pane.
Important Usage Notes
If you use multiple MAT-Files in a test vector, only commonly named variables included in all of the files will be read and used. For example, if you have variables in MAT-file A called Speed, Distance, and Pressure, and in MAT-file B you have variables Speed, Pressure, and Torque, only Speed and Pressure will be shown since they are included in both MAT-Files. Distance and Torque will not be used since they do not exist in both files.
If the order of execution of the MAT-files is important, then use the up and down arrows to order the files accordingly in the test vector table. Each MAT-file is one iteration of the test vector, and they are executed in the order they appear in the table.
The test vector is evaluated every time the test is run – that means the data is read from the MAT-File(s) every time the test is run.
If a MAT-File test vector is mapped to the inport blocks in a Simulink element using the All Inport blocks are mapped option, the model is simulated using all the variables that are selected in the Variables table in the test vector. If it is mapped to the inport blocks using the Individual Inport blocks are mapped option, the model is simulated with individually selected variables from the MAT-file.
Checking or unchecking the checkbox in the Variables table header will select or unselect all variables. It is a Select All/Unselect All toggle option. This option affects the variables selection behavior when you add or remove or select or unselect MAT-files in the MAT-file list on the General tab.
For example, if the checkbox is selected (to Select All variables) and then a MAT-file is added/removed or selected/unselected, all common variables will be selected by default.
If the checkbox is unselected (to Unselect All variables) and then a MAT-file is added/removed or selected/unselected, all common variables will be unselected by default.