Quantcast
Channel: Xojo Programming Forum - Latest topics
Viewing all articles
Browse latest Browse all 3791

Read and extract value from csv file

$
0
0

Hello,
Need help to extract values from csv file as nc(j,k) as shown in this vb6 code :

’ open the text file that contains the data
Dim fs As FileSystemObject ’ ******* need to reference Microsoft Scripting Runtime
Dim coefficientsFile As TextStream
Dim textFileData() As String

Set fs = New FileSystemObject
Set coefficientsFile = fs.OpenTextFile("C:\NavFolder\NutCoef.csv", ForReading)

'----- Read the coefficients from the data statements
'----- only if not already done.
If (NutTermsRead = 0) Then
    ReDim nc(1 To 106, 1 To 9) As Double
           
    For j = 1 To 106
        textFileData = Split(coefficientsFile.ReadLine, ",")
        For k = 1 To 9
            nc(j, k) = CDbl(textFileData(k - 1))
         'Debug.Print " nc() " & nc(j, k)
        Next k
    Next j
    NutTermsRead = 1


End If

coefficientsFile.Close
Set coefficientsFile = Nothing
Set fs = Nothing

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 3791

Trending Articles