06-27-2019 08:54 AM - edited 06-27-2019 08:55 AM
Hi AIEXINUK,
the dynamic outputs are simply like: 234134,2334535,131321,3453536......(value and comma and value and comma and value......),
So you receive a string of comma separated values? Why don't you convert this into an array of strings using the SpreadsheetStringToArray function?
(What are "dynamic outputs"?)
I don't have the skills to change how it was programmed (i am still a newbie) so I assume that I can change or add something after the output.
Don't change the device driver VIs - change the routine that calls all those device driver functions!
Here you can process the received data as much as you want…
06-27-2019 09:00 AM
So something like this then?
06-27-2019 10:41 AM
Yes! just like this.
I don't have the VI now so I just tried to use the circuit but the output from the excel is not expected..(got all the values into one column)
Here is attached files.
06-27-2019 11:43 AM
I am assuming that the "unexpected" part is that it was in column.
To put the data in rows, simply wire a TRUE to the transpose input
06-27-2019 11:47 AM - edited 06-27-2019 11:49 AM
You can transpose your 2D array before goes into the Write to Spreadsheet.vi with... You guessed it Transpose 2D Array.vi. if you want new rows in your spreadsheet data, then you need to a carriage return (newline) in your string data. Commas (or TABs depending on the delimiter you use) separate the string data into a new column. Newlines separate the rows. The escape character you can put in a string to make a newline is "\r\n".
EDIT: Ah yes, I forgot about the transpose input. Open that VI to see how it uses the Transpose 2D Array node inside.
06-28-2019 04:49 AM
That is what I want to accomplish, thanks!![]()
Here is the new thing, when I try to type the value like: 1.1515,1.5656 into string, it works fine and shows the correct value in the excel. But when I try to type the value like1.73984200E+07,+1.10680000E-04, somehow these values can not be correctly displayed in the excel. However I got the indicator after the 'spreadsheet to array' function while it shows the same values. Which means something goes wrong when the data flows into the 'Write the spreadsheet file' function?
06-28-2019 05:01 AM - edited 06-28-2019 05:02 AM
Hi AIEXINUK,
But when I try to type the value like1.73984200E+07,+1.10680000E-04, somehow these values can not be correctly displayed in the excel.
Please read the help for the WriteSpreadsheetFile function!
Read the help for ALL its inputs - also those you left unwired!
(Excel only shows what YOU have saved into that file: examine the file using an ordinary text editor!)
Btw: why don't you save that string constant directly to a file using WriteTextFile (using a filename suffix of CSV)? Excel will load it easily as you already got a spreadsheet string: no need to convert from string to numeric array and back to a string to save to a file!
06-28-2019 05:28 AM
Hi GerdW,
Very helpful! Solved the problem like that I never had!
One more questions about adding header into my excel from labVIEW, I saw many solutions in the community, one is: https://forums.ni.com/t5/Example-Programs/Add-a-Simple-Header-to-a-Spreadsheet/ta-p/3521839?profile....
I try to follow but it didn't work. While I am wondering if you could provide some ideas.
06-28-2019 05:37 AM - edited 06-28-2019 05:38 AM
Hi AIEXINUK,
I try to follow but it didn't work. While I am wondering if you could provide some ideas.
Did I suggested to read the help on WriteSpreadsheetFile? Especially for those inputs you left unwired?
Re-read it again!
Hint: you want to append data to a file already containing the header line(s)…
On your image: Why do you want to write the exactly same data into the file again and again? (Infact forever!)
06-28-2019 06:13 AM
Hi GerdW,
Cool, solved the problem now. Didn't understand what does append file mean, after tried many times by myself and now everything is clear.
Thanks for your help, have a good day.