To illustrate my point the code below (RAD). Multi-level work would be done and little time on my side too..
Any suggestion/request will be welcome
Code: Select all
#Include once "D:\Basic\LZLE_FBsite.bi"
Dim Shared GarbageCollector As List
Dim Shared WorkingIndex As List
WorkingIndex.HashTag(" ") 'Need one non null value before recycling or some other properties. To be fixed next ver.
Function a_Unique( A_Array() As Integer) As uInteger
Dim As Integer s=LBound( A_Array , 0 ) : Dim As Integer t=UBound( A_Array , 0 ) :
Dim As Integer i=0 : Dim As Integer k=0 : Dim As uInteger uCount=0
WorkingIndex.GarbageSnatch(GarbageCollector)
For i=LBound( A_Array , 0 ) To UBound( A_Array , 0 ) ' For each dimension...
For k=LBound( A_Array , i ) To UBound( A_Array , i )
If WorkingIndex.HashTag(Str(A_Array(i,k)))=1 Then
Print "array(" & i & "," & k & ")=0"
A_Array(i,k)=0 : uCount+=1
End If
Next k
Next
WorkingIndex.Recycle : GarbageCollector.GarbageSnatch(WorkingIndex)
Return uCount
End Function
Dim d_num As Double
Dim array() As Integer
d_num=a_Unique( array() )
Print "---"
ReDim array(10 To 11, 20 To 22)
array(1,10)=20
array(1,11)=11
array(2,20)=20
array(2,21)=11
array(2,22)=23
Print a_Unique( array() ) & " duplicates set to 0"
Print a_Unique( array() ) & " duplicates set to itself"
sleep
system