在fortran中定义一个数组
real, dimension(a,b) :: matrix
Run Code Online (Sandbox Code Playgroud)
如何在给定'矩阵'的情况下获得'a'和'b'?
阅读关于内在功能size
,shape
,lbound
和ubound
.
http://gcc.gnu.org/onlinedocs/gfortran/SHAPE.html
http://gcc.gnu.org/onlinedocs/gfortran/SIZE.html#SIZE
http://gcc.gnu.org/onlinedocs/gfortran/UBOUND.html#UBOUND
http://gcc.gnu.org/onlinedocs/gfortran/LBOUND.html#LBOUND
可能你想size(matrix,1)
和size(matrix,2)
或ubound(matrix,1)
和ubound(matrix,2)
.