help plz with debugging this error....

Discussion in 'Questions (Windows Mobile)' started by Stellaferox, Jul 1, 2007.

  1. Stellaferox

    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
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    It is missing the csv data file.
     
  3. Stellaferox

    Stellaferox Active Member Licensed User

    Sorry, about that.... here it is...
     
  4. specci48

    specci48 Well-Known Member Licensed 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
     
  5. Stellaferox

    Stellaferox Active Member Licensed User

    But RowArray gets initialized and filled in the sub InitValues which is called before sub Output.....
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    Your program fails in the second iteration of the Output loop.
    In the first call to ShufflePattern the RowArray is cleared, in the second time you are trying to get a data from the empty arraylist.
     
  7. specci48

    specci48 Well-Known Member Licensed 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 ...
     
  8. Stellaferox

    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
     
Loading...