help plz with debugging this error....

Stellaferox

Active Member
Licensed User
Hi guys,

I am having serious problems debugging an error which occurs in my program. I enclose the code. The error happens when the "TRAIN" button is pushed. This leads to a sub which is called ShufflePattern in which an array is randomly shuffled. I put in a msgbox to trace the error but I cant find why the error says "out of range".
Would somebody take a look and enlighten me plz...
Ignore the rest of the code. It's about neural networks.....
thnx in advance
Marc
 

specci48

Well-Known Member
Licensed User
Longtime User
The error happens because RowArray is empty:

RndNr = RND(0,RowArray.Count)

so RndNr = 0

ShuffleData(c) = RowArray.Item(RndNr)

RowArray.Item(0) doesn't exist => error!

But I haven't searched yet, why RowArray get's empty.


specci48
 

Stellaferox

Active Member
Licensed User
But RowArray gets initialized and filled in the sub InitValues which is called before sub Output.....
 

specci48

Well-Known Member
Licensed User
Longtime User
Yes, but you have 20 rows in your table and so you add 20 entries to you RowArray:
FOR RN = 0 to Rows-1
RowArray.Add(RN)
NEXT
If you look at you debug messagebox
count goes from 20 to 1
and
c goes form 0 to 19

Now all of your (20) added rows are removed from the RowArray.

And now, the Sub ShufflePattern is called again (I don't know why, I haven't analysed your code yet) ... but there is no entry in th RowArray left.


specci48


EDIT:
... as ususal ... a collision with Erles post ...
 

Stellaferox

Active Member
Licensed User
Guys,

You are magnificent!! I had totally overlooked the loop in which ShufflePattern in repeated without re-initializing the array. Thanks very much, works like a charm now...... remains the task of speeding up the code now....
thnx again!
Marc
 
Top