- 积分
- 35152
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2019-5-13
- 最后登录
- 1970-1-1
|
发表于 2020-4-15 19:53:38
|
显示全部楼层
不是很清楚你的意思,看样子建议看看where函数或者看下这个
Example 4
Assume x is a multi-dimensional array. Set any value greater than 50 to 50. Since ind only works with one-dimensional arrays, ndtooned, onedtond, and dimsizes must also be used:
if (any(x.gt.50.)) then
x1D = ndtooned (x) ; convert to 1D array
i50 = ind(x1D.gt.50.) ; all indices x1D > 50
x1D(i50) = 50. ; set all array syntax
x = onedtond(x1D, dimsizes(x)); return to the original array
delete (x1D) ; x1D no longer needed
delete (i50) ; i50 no longer needed
end if
This is similar to using the Fortran 90 "where" statement:
where(x.gt.50.) x = 50. |
|