Results 1 to 4 of 4

Thread: Reading numeric data arrays with row and column titles

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 1999
    Location
    Houston
    Posts
    48
    Using a tab-delimited ASCII text file, how can I read column titles and row titles into string arrays in the following format:

    var1 var2 var3 var4 var5 var6
    row1 0.00 0.00 0.00 0.00 0.00 0.00
    row2 0.00 0.00 0.00 0.00 0.00 0.00
    row3 0.00 0.00 0.00 0.00 0.00 0.00
    row4 0.00 0.00 0.00 0.00 0.00 0.00
    row5 0.00 0.00 0.00 0.00 0.00 0.00

    I can read in the numeric data without any problem.

    What method works best for reading each column title at each tab position, and what's the trick for detecting the carriage return at the end of the first row to force reading in the next row?

    Thanks,

    -LP

  2. #2
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840
    in VB6 (Not VB5) you can use the split function,

    DynamArray = Split(StrRow1, " " )

    this fills a zero base dynamic array of strings of the vars, use ubound(DynamArray) to find out how many vars are present

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 1999
    Location
    Houston
    Posts
    48

    in VB6 (Not VB5) you can use the split function,

    DynamArray = Split(StrRow1, " " )

    this fills a zero base dynamic array of strings of the vars, use ubound(DynamArray) to find out how many vars are present

    Thanks Paul:

    On other thing - a user has variable names with breaks, i.e. "alpha 1", "alpha 2", etc., but there is definately a tab character that I can see between the varnames. Split function wants a string delimiter such as " " rather than chr(10), so I cannot pick off tabs. Any suggestions on how to count tabs in a string rather than looking for " "?

  4. #4
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840
    the split function will take any string as a delimitor, I often write text files with "##" as a delimeter because you don't usually come across it, I know you can use vbTab (or vbCrLF for line splitting) in there, if 'chr(10)' doesn't work try 'chr$(10)' or set a string variable to chr(10) and put the variable in there.

    I've had almost any combination work,

    Good luck

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width