LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting labview to save data with a comma after the last column

Hello,
I have labview outputing data made up of several columns of data and they are each seperated by a comma, but the program that I have needs there to be a comma at the end of the data in the last column and it seems simple enough.  Just not sure how to do that.
 
Thanks

Message Edited by novastar15 on 11-10-2005 12:32 PM

0 Kudos
Message 1 of 11
(3,693 Views)
You say you are outputting data.  How?  To the screen, to a file?  Is your data in the form of an array (if so 1D or 2D)?  It is simple to append a comma.  If an array, you can simply use Insert Into Array and leave the index unwired.  The character will be put at the end of the array.
- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 11
(3,678 Views)
Hi,
 
I hope that is you want~

 

由 ycw7 在 11-11-2005 02:56 AM 上編輯的訊息

====================
●LV Version:LabVIEW7.1
●OS:WindowsXP(SP1)
●Hardware:PCI-7344, PCI-6602, PCMCIA 6024E
0 Kudos
Message 3 of 11
(3,679 Views)

The data I am saving is a 2-D array of number, and I am saving them into a text file.  Right a row looks something like 123, 342, 12334, 23342  so what I need is a comma after the last entry in every row so that the program can read the files.  Becuase it wants.  123, 324, 12334, 23342,

 

Thanks

0 Kudos
Message 4 of 11
(3,656 Views)
Unfortunately you can't use Write Spreadsheet to File because that puts an End of Line after each row.  Even Array to Spreadsheet String puts EOL after the line, so you can't simply append a comma.  You have to break down the array into each element, change to string, concatenate all elements with commas after each element, then add EOL after each row.  See attached vi on how to make the string.  Then write this string to a file.
- tbob

Inventor of the WORM Global
0 Kudos
Message 5 of 11
(3,643 Views)

Hi NovaStar15,

Would this work for you?

When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 6 of 11
(3,638 Views)
Another approach to tbobs would be to
 
1. Use convert using Array to Spreadsheet String.
2. Replace all <CR><LF> with <,><CR><LF>. The string constants are viewed in '\' mode. \r is <CR> and \n is <LF>
3. Reverse the string and look for the last <LF><CR> using match pattern.
4. Extract the portion of the string after the match
5. Reverse it back and you should be left with a comma seperated list without the last <CR><LF> ready to write to file.
 
I have attached simple example in 7.1.
 
David
 
 
 
ps Dynamik your images were not there. It was only the the empy image place holders (box with red X)
0 Kudos
Message 7 of 11
(3,620 Views)

Thanks David!  Yes, it looked just fine on my screen.

Well these just show piping the 2D array straight into the ArrayToSS String -

... but using the format string to put comma after every value...

 

When they give imbeciles handicap-parking, I won't have so far to walk!
Download All
Message 8 of 11
(3,615 Views)
Great solution Dynamik.  For that you get 5 stars.  I never thought about putting a comma in the format string.
- tbob

Inventor of the WORM Global
0 Kudos
Message 9 of 11
(3,595 Views)
Thanks for the help guys, I will give those give those solutions a try today!
 
🙂
0 Kudos
Message 10 of 11
(3,581 Views)