Lexington Posted June 12, 2013 Share Posted June 12, 2013 Hello, I am experiencing trouble using ReadDelim. When I try to run: global string SavedGraphsprivate FileHandle = file.open("C:\DAQFactory\SavedGraphs.cfg",1,0,0,1)SavedGraphs=file.ReadDelim(FileHandle,-1,",",chr(10),1)[/CODE]For the file with data:[CODE]First Graph,A7225,mm,A74424,mm,,,,,,,,,,,,,,,,,,,,,,,,,,,,Moo,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,[/CODE]it gives me {{"NaN","NaN"..."NaN"}}However if I use parse instead:[CODE]global string SavedGraphsprivate FileHandle = file.open("C:\DAQFactory\SavedGraphs.cfg",1,0,0,1)SavedGraphs=parse(file.Read(FileHandle) ,-1,",")[/CODE]It gives me the correct values. However, I would rather use readDelim since it can parse returns. Is there something that I did wrong?LexingtonSavedGraphs.txt Link to comment Share on other sites More sharing options...
AzeoTech Posted June 13, 2013 Share Posted June 13, 2013 You need another ,1 at the end of the readDelim() call. Its an optional parameter that tells the function that the data is all strings, not all numbers. See section 9.9 in the user's guide. Link to comment Share on other sites More sharing options...
Lexington Posted June 21, 2013 Author Share Posted June 21, 2013 Thank you for the last tip. I saw it in the user manual but, I must have somehow missed it. However, I now have another problem with readdelim, this time it is a bit more perplexing. Whenever I try to read the attached file, at line 22, the array that is read is {"","F74841",""} instead of {"F74841","","Centrifuge..."}. The lines above it are fine, however, the lines below it are shifted over as well. Is there any way to fix that? Point Descriptions.csv Link to comment Share on other sites More sharing options...
AzeoTech Posted June 24, 2013 Share Posted June 24, 2013 There is a line feed character after "Rate" and before the closing quote. Depending on the parameters passed to readDelim() this is probably throwing it. Note that you can't see the line feed in Notepad as it ignores them, but you can see it in Write. Link to comment Share on other sites More sharing options...
Lexington Posted June 25, 2013 Author Share Posted June 25, 2013 Ah thank you, I did not notice that. Lexington Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.