04-07-2019 02:33 PM
Hello,
I am saving a 2D data to a spreadsheet file (2 columns of values), how can I save one single extra value to the file (I tried 1 element 3rd column but wasn't successful). The single value is result calculated from the large data. Idk if my task is as specific but couldn't find any clues.
04-07-2019 02:57 PM
04-07-2019 03:12 PM - edited 04-07-2019 03:15 PM
There is no VI I have problem with, as I have a big VI, needless to post (if I post it I will get response to a bazilion things I didn't ask), where the 2D part of saving works, I want to add the functionality to add the single value. Currently I am using save to spreadsheet to save the two columns. that works. I don't know how to attach single element to a block that expects array. Maybe I should build 1 element array but then the dimensions doesn't fit.
04-07-2019 03:20 PM
Ok appending with second "save to ss" works, now I only need to make it append as 3rd column.
04-07-2019 03:20 PM
You do know that a "Spreadsheet file" is just a text file, don't you? So you could simply read it as a Text file (say, line-by-line) and write it out with another name (at least while testing, so you don't "destroy your data" while your testing your ideas). If you do this, can you figure out how to add a single value (a) at the beginning of the file, or (b) at the end of the file? [This is really a very simple question -- don't "overthink" it].
Bob Schor
P.S. -- a Text file means that the data in the file consist of strings, usually separated by "line-terminator characters", most typically the character pair <CR><LF> (Carriage Return, hex D, and Line Feed, hex A). Check out how Read from Text File works. I'll note that the Help documentation is unclear about how to turn on and off "Read Lines" -- right-click the function on the Block Diagram and click "Read Lines" from the Drop Down to change the function.
04-07-2019 03:30 PM - edited 04-07-2019 03:35 PM
So, two blocks of "save to SS file" solved it, first saves 3 arrays of 1 element (dummy header for data columns and a single value as third), then the second one appends transposed data. Was simple I just didn't want to trial and error at 23 pm...
04-08-2019 08:05 AM
If you write the result table with one "write delimited file", you can add data with the input "Append to file", else it'll restart and will only result in the last line written as the only one.
/Y