Jump to content

Inputing text file into multidimension array Please help!

- - - - -

  • Please log in to reply
No replies to this topic

#1
drdcs15

drdcs15

    Newbie

  • Members
  • Pip
  • 1 posts
So i have a text file with x,y,z coordinates. i.e.:

12,4,-5
13,-9,5
etc...

I have to do math (iterations to find best fit circle from points, distance from center of best fit circle, etc.) eventually, but I can figure that out on my own, no need to waste your time.

What I have been trying and failing to do for forever is to separate these values out into 3 string arrays (an x string array, y, and z string array) or into one multidimensional array. Please can someone help me with the code to do this? I don't care between the multidimensional or 3 separate arrays, whatever you think will be easier to work with.

Thank you for your help!!

Here is my code:

Imports System

Imports System.IO

Imports System.Math


Public Class Form1


    Private Sub file_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles file.Click


        'VARIABLES

        Dim FileLoc As String



        'Openfiledialog Settings

        OpenFileDialog1.Title = "Select IGS File"

        OpenFileDialog1.Filter = "Text Files|*.txt|IGS Files|*.igs|All Files|*.*"

        OpenFileDialog1.FileName = "IGS file"



        'Show dialog

        Dim DidWork As Integer = OpenFileDialog1.ShowDialog()



        'cancel button

        If DidWork = DialogResult.Cancel Then


        Else

            'INPUT text file into LINES string

            FileLoc = OpenFileDialog1.FileName

            Dim Lines() As String = IO.File.ReadAllLines(FileLoc)


            'Isolate FILENAME

            Dim parts As String() = FileLoc.Split(New Char() {"\"c})

            Dim partslength As Integer = parts.Length - 1

            Dim Filename As String = parts(partslength)


            'Split LINES into X,Y, and Z

            Dim num As String

            For Each num In Lines



            Next






        End If


    End Sub

End Class






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users