User`s guide
4 Usage Examples
4-2
Magic Square Examples
The M-file mymagic takes a single input, an integer, and creates a magic square
of that size.
The Excel file
mymagic.xls uses this function in three different ways:
• The first illustration calls the function mymagic with a value of 4. The
function returns a magic square of size 4 and populates a range of Excel cells
with that magic square.
• The second illustration uses the transpose flag to transpose a magic square
of size 4.
• The third illustration resizes the output to a higher value and moves its
location within the Excel worksheet.
Note To get started, copy the distributed directory xlmagic from
<matlab>\toolbox\matlabxl\examples\xlmagic to <matlab>\work.