User`s guide

Add Report Content Using Components
2-21
The next three steps set up the report to delete the image from the MATLAB
workspace after the image has been added to the report.
8
In the Outline pane, select the Figure Snapshot component.
9
In the Library pane, under the MATLAB category, double-click Evaluate MATLAB
Expression.
10
In the Properties pane:
a
Clear the Insert MATLAB expression in report and Display command
window output in report check boxes. You do not want to include the code or
its output in the report.
b
In the Expression to evaluate in the base workspace text box, replace the
existing text with the following text:
%This command deletes the Durer image
delete(gcf);
The delete(gcf) command deletes the current image in the MATLAB
workspace, in this case, the Dürer etching.
c
In the Evaluate expression if there is an error text box, replace the existing
text with the following text:
disp(['Error during eval: ', evalException.message])
This code executes if an error occurs while deleting the Dürer etching.
11
Save the report.
Create the Magic Squares and Their Images
In the next steps, you add a chapter to the report for each magic square specified by
the magicSizeVector report variable. You use a For Loop component to perform this
essentially repetitive task. To create the magic squares and their images, you perform
these tasks:
“Create a For Loop” on page 2-22
“Add a Chapter for Each Square” on page 2-24
“Determine the Matrix Size” on page 2-26
“Insert the Magic Square Size into the Report” on page 2-28