magic
Magic square
📝Syntax
M = magic(N)
📥Input Arguments
Parameter Description
N Matrix order, specified as a scalar integer.
📤Output Arguments
Parameter Description
M result of magic function.
📄Description

M = magic(N) computes an square matrix constructed as an arrangement of the 1:n^2 such that the row sums, column sums, and diagonal sums are all equal to the same value.

💡Examples
M = magic(3)
🔗See Also
ones
🕔Version History
Version Description
1.0.0 initial version
Edit this page on GitHub