how do you iterate through an array in fortran?
Question
really simple question.
say I have
real, dimension(0:100) :: realResults
and I want to iterate over realResults, ultimately to create json of the array of the form
[[x1,y1], [x2,y2], [x3, y3], ... ]
I'm pretty sure I want to use "do" but I'm not sure how
thanks
Solution
In Fortran 90 you can do array iteration like:
do i = lbound(realResults), ubound(realResults)
! do something with realResults(i)
end do
OTHER TIPS
FORTRAN and json in the same paragraph?!?! WTF? Maybe something like:
do 10 i = 0, 100
C do something with realResults(i)
10 continue
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow