02-02-2020 01:00 PM - edited 02-02-2020 01:04 PM
Not sure why but despite stripping out all the new lines and carriage returns with regex combined with search and replace, there's still a new line being put in. There is supposed to be one invisible unicode character at the end of this I'm wondering if that's the problem. When I look at my indicator for the buffer that shows whats going into the Write Deliminated Spreadsheet, there are no newlines or carriage returns, evidenced by using the arrow keys and going through the string. Really stumped on this one hopefully someone knows this issue. I have another program that uses just about the same code and it doesn't have this issue which suggests it's something in this unique output that the device is putting out but I can't figure it out. The message originally looked like this "\r\u003e meas x\r\n\rx = 78.8 uT\n\r\n\r\u003e "
without the quotations, then the reg ex got it down to 78.8 uT so I'm wondering how there is those newlines in the file. Thank you.
Solved! Go to Solution.
02-02-2020 02:03 PM
Solved by putting the file writing code inside the case with the "After Match" string indicator.
02-02-2020 03:09 PM
Disregard that one I'm still getting the problem but with one less new line.
02-02-2020 04:29 PM
Attach your VI.
A tiny screenshot of an Excel spreadsheet doesn't tell us what you're doing wrong.
02-02-2020 05:59 PM
Ok I have it in the top reply but I will post the latest one that only has the one new line. Here's the newest csv as well.
02-02-2020 09:09 PM
Sorry I have to remake this one because I thought I had it solved but I really did not. Some how there is a newline character being introduced into my Write Deliminated Spreadsheet file stream. Not really sure how. I have an indicator that shows me exactly what will be written before it gets written and no \n's or \r's that I can see. Was hoping if someone could look over the main loop and the file writing part to see if anyone can quickly figure it out.
02-02-2020 09:44 PM
I can't test it out and your code layout is hard to follow (wires going everywhere), but perhaps your Search and Replace is not doing what you wanted? It will only replace the first "End of Line" constant because you have not wired a True to the "Replace All?" input. It is also possible that you are not searching for the correct "end of line" type since on Windows it will search for a "\r\n" combination only. I can only guess because you have not supplied any indication of the data going through.
02-02-2020 10:19 PM
"\r\u003e meas x\r\n\rx = 78.8 uT\n\r\n\r\u003e "
this is what one line of the data coming out is. Really crazy I know. I apologize for the mess I'm kinda trying everything to get this part to work, probably the hardest thing so far. Weird, I had that set to true before I must have deleted it just to try and see what it would do. The reason the loop has to go through 11 iterations is, you send it a command "meas x" and it spits it back out at you one char at a time like so.
">"
"m"
"me"
"mea"
"meas"
"meas x"
"meas x = 42.7 uT"
with unicode 003e at the start and end. I will try your suggestion though I did have that set to true before not sure what happened. My hypothesis was that it was that the Write Deliminated Spreadsheet was introducing a newline after an iteration of the loop because in my other program where I'm writing two columns simultaneously it doesn't do that and it's basically the exact same code exact for that part.
02-02-2020 10:36 PM
Ok, so a couple of simple comments then I'll look at the end of line bits:
(numbered for reference in replies etc, not importance)
Array to Spreadsheet separates rows with EOL characters. If your spreadsheet application needs different terminators, use the Search and Replace from the String palette (or something equivalent) at the output of Array to Spreadsheet String to modify the string.
Since you're going to drop the WDS node (in favour of Write to Text File) and you may or may not need the Array to Spreadsheet String, this should be easier to appropriately handle.
02-03-2020 12:48 AM
Wow you are a genius, array to spreadsheet was inserting a newline and I didn't know it. Don't think I would have gotten that any time soon. I followed everything you said and it works great now I'm really excited. Thanks for taking the time to look through that mess I have cleaned it up and here it is.