Hi,
I a simple problem that I haven’t been able to solve:
I want to create a zero to n+1 by zero to m+1 integer array from a 1 to
n by 1 to m real array (IntArray(0:n+1,0:m+1) from RealArray(1:n,1:m).
The real array consists of zeros and minus 1 values. The resulting
integer array should have the integer transformed real values surrounded
by a frame of specified values (-1 in the following example).
Example real array input:
0.0 -1.0 0.0 -1.0 0.0
-1.0 0.0 0.0 -1.0 0.0
0.0 -1.0 -1.0 0.0 0.0
-1.0 0.0 0.0 -1.0 0.0
0.0 -1.0 -1.0 0.0 0.0
Desire Result
-1 -1 -1 -1 -1 -1 -1
-1 0 -1 0 -1 0 -1
-1 -1 0 0 -1 0 -1
-1 0 -1 -1 0 0 -1
-1 -1 0 0 -1 0 -1
-1 0 -1 -1 0 0 -1
-1 -1 -1 -1 -1 -1 -1
I initially tried a nested set of do loops like
Do j = 1, m
Do i = 1, n
IntArray(i,j) = Int(RealArray(i,j))
Enddo
Enddo
IntArray was incorrect.
Then I tried IntArray(1:n,1:m) = RealArray(1:n,1:m)
IntArray was still incorrect.
Any suggestions?
Craig Shirley
Desert Research Institute
755 East Flamingo
Las Vegas, Nevada USA 89119
Voice: (702) 862-5454
Fax: (702) 862-0427
"Without deviation from the norm, progress is not possible." -- Frank
Zappa
|