User`s guide
2 Create Your First Report
2-30
To create the magic square and display the associated matrix or image, use the Evaluate
MATLAB Expression component.
1
In the Outline pane on the left, select the bottom Paragraph component.
2
In the Library pane in the middle, under the MATLAB category, double-click
Evaluate MATLAB Expression.
Make this component a sibling of the Paragraph component, not a child, as
described in the next two steps.
3
In the Outline pane, select the Eval component.
4
Click the left arrow on the toolbar to make the Eval component a sibling of the
previous Paragraph component.
5
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 MATLAB code.
Tip Copy and paste this text from the HTML documentation into the Report
Explorer.
%This MATLAB script produces a magic
%square of size magic_Square_Size
%and creates an image of that square.
mySquare=magic(magic_Square_Size);
clf
imagesc(mySquare);
title(sprintf('Magic Square N=%i',magic_Square_Size))
set(gca,'Ydir','normal');
axis equal;
axis tight;
This code creates a magic square matrix mySquare of size
magic_Square_Size, and opens an image of that matrix in the MATLAB
figure window.