Documentation Center

  • Trial Software
  • Product Updates

MATLAB Expression Test Vectors

Test vectors define the parameter space or set of test cases you want to run. Test vectors are composed of values that can be derived from a MATLAB® expression. You can use any MATLAB expression that evaluates to a 1-by-N matrix or cell array to define your test vector. You must have at least one test vector defined to run a test.

The total number of Main Test iterations is determined by permuting all test vector values. For example, if one test vector is a 1-by-3 array and another is 1-by-2, it would result in a total of six iterations covering all the test vector value combinations.

To add a test vector:

  1. Click the New button in the Test Vectors pane.

    In the Insert New Test Vector dialog box, keep the default test vector type of MATLAB Expression.

  2. Assign a name to the vector in the Name field.

  3. Enter the value by typing in values or a MATLAB expression in the Expression field.

    The Size field fills in automatically based on what you entered if you press Enter or click outside of the Size field. For example, if you entered 1 : 1 : 10 in the Expression field, the Size would be a 1 x 10 double, which means 10 iterations.

  4. Select the Evaluate Test Vector each time the test is run option if you want to use new values every time the test is run. For example, if your expression included a rand function, a new set of random numbers would be calculated each time. Leave it unselected if you want to use the same values each time the test is run.

  5. Click OK in the Insert Test Vector dialog box.

    The new vector appears in the Test Vectors pane.

    Note:   Grouping test vectors determines how they will be iterated through when the test runs. For information on grouping vectors, see Grouped Test Vectors.

For an example of creating test vectors in a test, see Create a Test Vector.

Was this topic helpful?