Menu

Reading data from a .csv file into GW Basic

Anonymous
2015-09-09
2015-09-09
  • Anonymous

    Anonymous - 2015-09-09

    I have a large excel speadsheet of x,y coordinates (columns A and B). I have a written a GW basic program that manipulates x,y coordinates when input one by one. Now I would like to read in my columns A and B from excel (assuming I would save as a .csv file), have GW basic do it work on each point, sequentially, and then output the results back into a .csv or excel file. Any thoughts?
    Cheers
    JohnnyB

     
  • Rob Hagemans

    Rob Hagemans - 2015-09-09

    I imagine your code would do something like this

        OPEN "DATA.CSV" FOR INPUT AS 1
        OPEN "OUTPUT.CSV" FOR OUTPUT AS 2
        WHILE NOT EOF(1)
            INPUT#1, X, Y
            X2 = ...(calculation on X and Y here)... 
            Y2 = ...(and here)...
            WRITE#2, X2, Y2
        WEND
        CLOSE
    

    Are you running into a particular problem? If something does not work as expected, please post your code and I can see what's going on.

     
    • John Brzorad

      John Brzorad - 2015-09-09

      Awesome, Rob. I knew it had to be fairly simple. I read in 12,000 xy points, printed them, read them into a new .csv file. Now to do the checks on each point. Thanks for your help.
      Johnny B

       
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.