User`s guide
Add Report Content Using Components
2-27
Extract the size of each magic square matrix from magicSizeVector using an Evaluate
MATLAB Expression component.
1
In the Outline pane on the left, select the bottom Chapter component.
2
In the Library pane in the middle, under the MATLAB category, double-click
Evaluate MATLAB Expression.
3
In the Properties pane on the right:
a
Clear the Insert MATLAB expression in report and Display command
window output in report check boxes.
b
In the Expression to evaluate in the base workspace text box, replace the
existing text with the following text:
magic_Square_Size=magicSizeVector(MAGIC_SQUARE_INDEX);
This command extracts the next size for the magic square from the vector
of sizes initialized in the first Eval component of the report. The variable
magic_Square_Size represents the size of the current magic square being
processed.
c
In the Evaluate expression if there is an error text box, replace the existing
text with the following:
disp(['Error during eval: ', evalException.message])
This code executes if an error occurs while attempting to extract a value from
magicSizeVector.
The Outline pane looks as follows.