Hello,
I have a large one-dimensional array consisting of about 2000 elements, most of them has ZERO values and only small part of them contains NON-zero value: I need to extract from it the NON-zero values only.
So, I used the PACK function with mask as follows:
...
INTEGER, ALLOCATABLE :: D(:)
...
IF (.not. ALLOCATED (D)) ALLOCATE (D(en))
d=pack(up,mask=up.ne.0)
....
The number of non-zero elements (en) is found in a procedure preceding the call to the PACK function.
Basically, the PACK function works fine and I get the array D(en) with non-zero values only, which becomes then an one-dimensional array with 20 non-zero values only.
If I create a release EXE version - it runs (apart from a problem with DRAW_POLYLINED@ which does not join the lines).
However, when I check the /UNDEF option for debugging and run the debug process - the debugger says:
RUN-TIME error 112. Reference to undefined variable, array element or function result (/UNDEF) and points to the newly created one-dimensional array with 20 elements (array named UP in the code above).
My question is: when I use the PACK function, it creates a new array of the same dimension (one dimension with 20 non-zero elements in my case) and the rest zero elements are disregarded (I suppose so) or not and still keeps the information about the original input array (in my case - one-dimensional array named UP with 2000 elements)?
Thanks!
Martin


