Fortran Coder

标题: 函数index的用法 [打印本页]

作者: sweetxu    时间: 2021-10-12 21:04
标题: 函数index的用法
函数index能否可以实现对数组元素下标的索引;若不可以,怎样能实现对数组元素下标进行索引,如有表述不正确,还望赐教,谢谢!

作者: li913    时间: 2021-10-13 10:22
本帖最后由 li913 于 2021-10-13 10:26 编辑

index用于在字符串中搜索特定字符的位置。具体的,你查帮助
https://software.intel.com/conte ... -reference/top.html

1111.jpg (112.65 KB, 下载次数: 181)

1111.jpg

作者: fcode    时间: 2021-10-13 14:22
对数组查找可以用 findloc 函数。integer :: array(100)
j = findloc( array , 3 , 1 )
有些老的编译器不支持 findloc 函数,也可以用 minloc/maxloc 函数代替
j = minloc( array , 1 , array == 3 )






欢迎光临 Fortran Coder (http://bbs.fcode.cn/) Powered by Discuz! X3.2