A{5}=magic(5)
A{5}=magic(5)
magic(n)生成一个n阶幻方,就是把1-n^2排成一个nxn的矩阵,使得矩阵的每行、每列,以及主、副对角线上面的n个数之和都相等(容易证明,这个和等于n*(n^2 1)/2)。
magic(n) generates a magic square of order n, which is to arrange 1-n^2 into an nxn matrix, so that the sum of n numbers on each row, each column, and the main and sub diagonals of the matrix are equal (It is easy to prove that this sum is equal to n*(n^2 1)/2).
B=A{5} 即A{5}赋值给了B
B=A{5} ie A{5} is assigned to B
04结构体 Structure
Books=struct(’name’,{{Machine Learning’,’Data Mining’}},’price’,[30 40])
( )内的几位结构体,赋值给books
Books=struct(’name’,{{Machine Learning’,’Data Mining’}},’price’,[30 40])
Several structures in (), assigned to books
Books.name 在books中选取name的属性
Books.name select the attribute of name in books
Books.name(1)
Books.name{1}