如何在fortran中获取数组的起始索引

时间:2014-03-04 17:31:04

标签: fortran fortran90

在fortran中定义一个数组

real, dimension(a,b) :: matrix

如何在'矩阵'下获得'a'和'b'?

1 个答案:

答案 0 :(得分:8)

了解内在函数sizeshapelboundubound

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)