Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

magic (MathScript Function) (Windows, Not in Base Package)

LabVIEW 8.5 Help
August 2007

NI Part Number:
371361D-01

»View Product Info

Member of the matrix class.

Syntax

c = magic(a)

Description

Generates a magic square. A magic square has equal row, column, and diagonal sums. If you can express the width of the square as an odd number or as a multiple of 4, the magic square is a diabolic, or pandiagonal, square whose subdiagonal sums also equal the diagonal sums.

Examples

Inputs

Name Description
a Specifies the size of the magic square. a is an integer greater than 2.

Outputs

Name Description
c Returns an a-by-a magic square. The elements in c are integers from 1 to a^2. c is a matrix.

Examples

A = magic(10)


Resources


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit