Start New Discussion within our Software Development Community

Hi Group,

Need some help. I'm performing some statistics on a txt file that has multiple columns using a collection list ( 2008). My files can contain 100,000+ samples per file.

How would I code my function to have it perform work on the first 3000 samples and continue the calculations on every 3000 samples thereafter? Thx!

Private Sub decimationButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles decimationButton.Click

        Dim lines() As String = System.IO.File.ReadAllLines(inputFileName) '("TEXT_FILE")

        Dim list As New List(Of Double())
        For Each str As String In lines 
            Dim ele() As Double = Array.ConvertAll(str.Split(vbTab), Function(k) Double.Parse(k))

        'Output an ASCII Text File EDA Analysis
        Dim FILE_NAME As String = "C:\Output.txt" 
        Dim objWriter As New System.IO.StreamWriter(FILE_NAME, False) '
        objWriter.WriteLine("Easting     " & vbTab & "Northing     " & vbTab & "Depth" & vbTab & "East Mean" & vbTab & "D Mean" & _
                            vbTab & "E StDev" & vbTab & "D StDev" & vbCrLf)

        For Each d As Double() In list 'THIS DOES WORK ON THE ENTIRE FILE
            'Perform Exploratory Data Analysis on every 3000 samples 
            'Calculate Mean Values
            Dim depthMeanVal As Double
            Me.calcMean(list, eastMeanVal, depthMeanVal)

            'Calc Standard Deviation
            Dim eastStDev As Double
            Dim depthStDev As Double
            Me.calcStDev(list, eastStDev, depthStDev, eastMeanVal, depthMeanVal)

        Next 'For Each Loop

    End Sub

So it looks like I'll have to use IEnumerable and IEnumerator. Anyone know how to use these?

This article has been dead for over six months. Start a new discussion instead.