Writing arrays to spreadsheet w/ timestamp

Hi. I'm trying to build an application which will write a set of thermocouple values to a spreadsheet with a timestamp at the beginning of each row. What I have so far is a countdown loop which gives me regular intervals of time. When the loop reaches zero, the set of values in a global array variable goes into an "Array to Spreadsheet String.vi" then I use the Concatenate string to put a timestamp string, a space and the spreasheet string. Since "Write to spreadsheet.vi" needs an array input, I have to use the "Spreasheet string to Array.vi" then to the "Write to Spreadsheet.vi" So what this does is writes the TC values, but the timestamp gets lost somewhere in there and it write a completely wrong value
which looks nothing like a timestamp.
I appreciate any comments on this.

In order to add a timestamp to each row, you will need to use the "write characters to file" VI. Since a spreadsheet is just a tab-delimited text file, you can use the "array to spreadsheet string" function to convert your array of data into a tab delimited string. Once you have this string, you can concatenate your time data to the start of it and write the resulting string to file.
I have created a simple example that writes randomly generated numbers to a spreadsheet every 0.5 seconds with a timestamp for each row. Hope this helps!
Attachments:
timestamp_spreadsheet.vi ‏20 KB

Similar Messages

  • Array to Spreadsheet suppress errors

    Is there a way i can supress errors from an Array to Spreadsheet node.
    If the file is open and it cant write to it then it creates an error box and the VI stops running until you click continue. I simply want it to ignore the error and keep running without writing to the spreadsheet. 

    Since this is not a low level File I/O VI, it does not have error terminals in/out. I would suggest you to use a low level VI set, like the "Open/Create/Replace File", Write to Text File", and the "Close File" VIs. In this way you have more options to catch and handle the error.
    Or you can modify the high level "Write to Spreadsheet File" VI to have error terminals in and out (and deleting the pop-up terminal from inside)... But NEVER ever modify&save an original LabVIEW system VI, first save it under a different name and location!
    See here:
    http://forums.ni.com/t5/LabVIEW/How-do-I-catch-errors-from-quot-Write-to-Spreadsheet-File-quot/td-p/91166
     

  • Array to spreadsheet string - remove space after delimiter

    Hi
    I created a Labview program to acquire a electrical signal and send it using TCP/IP.
    The image in attachment shows a piece of my code. The AQ subVI was created by me to accomplish the acquisition.
    However, the string that the "array to spreadsheet string" VI returns is something like this:
    -0.800781^ -1.030273^ -1.098633^ -0.942383^ -0.644531^ -0.209961^ 0.258789^ 0.712891^
    The VI is using the ^ character as a delimiter and it is converting commas to points as decimal separators.
    Now, what i would like to do is to remove the space character between the ^ character and the sample value, simply because that is what the receiver of the TCP/IP message wants.
    Can anybody help me?
    Thanks in advance
    Attachments:
    Array to spreadsheet.png ‏7 KB

    hi there
    remove the space between the ";" and "%" in your format specifier.
    Best regards
    chris
    CL(A)Dly bending G-Force with LabVIEW
    famous last words: "oh my god, it is full of stars!"

  • Deleting all elements from array and array to spreadsheet string

    Hello,
    I would like to write a new data file for each "recording" session without closing the VI.  My problem is that the last "recording" session's data is at the top of every successive session's text file.  I do not want this.  I've tried to delete all rows from the array after my array to spreadsheet string function, but I think the problem is somewhere with the shift register and how the array is built.  I'm not too familiar with LabView and this aspect of my interface is driving me crazy.  Attached is my code and two successive data files.  I have not been able to find a solution on these or the LAVA forums.  Any help would be appreciated.
    Also, I know there is an easier way to write this kind of streaming data, but I need to do it this way for other devices and synchronization purposes.
    Attachments:
    testsecond.txt ‏90 KB
    test41.vi ‏80 KB
    testfirst.txt ‏78 KB

    A few more comments to your code:
    Your loop does not have a wait, meaning it spins the empty case millions if times per second, consuming all CPU while not doing anything. Add an indicator to [i] to see.
    To clear a 2D array in one case frame, just don't wire the output tunnel and set it to "use default if unwired". You'll get an empty array. No fancy tools needed.
    I probably would use an event structure and also protect the data if the save dialog is canceled.
    Here's a simple draft that probably requires a bit more work but should show some of the ideas.
    You should also
    add some protection that the VI cannot consume all available memory if it runs forever.
    Create a seperate case to save the data later if the file dialog is cancelled the first time.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    test41MOD.vi ‏107 KB

  • Trouble with array to spreadsheet string

    I am having trouble with the array to spreadsheet string.
    I have a 1-d array of string, the output spreadsheet string never puts a space on the first row, but all others.
    example:
    05:59:29.170    00000101     8        00 00 07 00 0B 0E 0D 0C
     05:59:29.198    00000100     8        00 00 3A 3A 39 39 39 39
     05:59:29.220    00000101     8        00 00 07 00 0B 0E 0D 0C
     05:59:29.248    00000100     8        00 00 39 39 39 39 39 39
    format string is %s and default tab is delimiter.
    this is screwing up my program because of the "scan for string" function can't be used correctly if the spreadsheet string isnt consistent.
    Any suggestions?
    Thanks

    You don't need to use "array to spreadheet string": You could use plain formatting for full control over the output.
    Still, your observation is a bit odd. Could you attach a simple VI that shows the behavior? (Put your input array into a diagram constant).
    LabVIEW Champion . Do more with less code and in less time .

  • \0D and \0A after array to spreadsheet string conversion

    Hi guys, i currently have a VI that manipulates a couple of arrays and writes them to a config file through the config VI.
    Now, i notice 1 problem whereby after my array is comma delimited and converted into a spreadsheet string, a tab and carriage return automatically appears at the end of the string. This causes my resulting config file to have \0D and \0A to appear with my keys in the config file.
    I know it's got to be the array to spreadsheet string conversion that's causing the problem because i don't have such \0D and \0A problem with keys without the conversion.
    How do i solve this?

    The OD and OA are the carriage return and line feed and yes the functona always appends these characters at the end of each line. Probably because this function is normally used to create files that a spreadsheet can read. There are several ways to remove the extra characters. Shown below is the string reversed and the String Subset function uses an offset of two. The output of that is reversed to get a string without the CR and LF. Also shown is getting the string length, subtracting 2 and wiring that to the length input of the String Subset function.
    Message Edited by Dennis Knutson on 07-26-2007 10:57 PM
    Attachments:
    Strip Last Two Characters.PNG ‏6 KB

  • Array To Spreadsheet String and DDE

    I have an array (one dimensional) that I want publish as a dde topic.
    So far I've been able to write all my dde components appear to be working,
    with the exception of the dde set value function in conjunction with Array
    To Spreadsheet String function.
    Array to spread appears to parse the the array the way I want it (that is,
    to create one
    big string with newline chars seperating tokens) but it's output does not
    seem to set correctly. If I look at the value right after I convert it to
    a spreadsheet
    string its good, but if I check it (once it's been loaded) using
    DDE Srv Check Item it comes up blank.
    Does anyone know what I'm doing wrong? I'm feeding the output of array
    to spread driectly into DDE Srv Set Item, shou
    ld it be going through another
    function first? Or am I using the wrong function to parse my array? My
    DDE
    server seems to work ok if I just use single string values, is there something
    about using arrays that I should be aware of? Any feedback is appreciated.

    Hi aschipfl,
    some thoughts about your suggestion:
    - When you want to suggest improvements to LabVIEW you should post in the Idea Exchange.
    - NI will not change the behaviour of functions existing for a long time…
    - NI will probably update the LabVIEW help for that function…
    - a spreadsheet string needs some kind of delimiter, what's the purpose of creating a spreadsheet string without them?
    When you really need a "Array to Spreadsheet String" without delimiters you could take this approach:

  • Array To Spreadsheet String, Empty Delimiter

    The Array To Spreadsheet String function does not accept an empty Delimiter, it uses the Tab character in such case.
    The same is true for the Spreadsheet String To Array function (but of course this function cannot work without a Delimiter).
    I would appreciate one of the following options:
    to allow an empty separator for both functions (for Array To Spreadsheet String this can easily work obviously; for Spreadsheet String To Array you might see an empty string delimiter between each two adjacent characters similar to the Search and Replace String function with an empty search string);
    to document that behaviour properly;
    I would prefer the first option espacially for the Array To Spreadsheet String function. What do you think?

    Hi aschipfl,
    some thoughts about your suggestion:
    - When you want to suggest improvements to LabVIEW you should post in the Idea Exchange.
    - NI will not change the behaviour of functions existing for a long time…
    - NI will probably update the LabVIEW help for that function…
    - a spreadsheet string needs some kind of delimiter, what's the purpose of creating a spreadsheet string without them?
    When you really need a "Array to Spreadsheet String" without delimiters you could take this approach:

  • Write array to spreadsheet string

    Hi,
    I have 3 numeric arrays and 1 string array.  I am try to use the function write array to spreadsheet string.  What is the easy way to do this, since I have both numeric and string, I can't create a 2d array directly?
    Yik
    Kudos and Accepted as Solution are welcome!
    Solved!
    Go to Solution.

    It depends how you want the file to store the data.
    Attached is an example of two methods mentionned above.  You can change the formatting so that you have the data on the same line or different lines.
    There are many solutions depending on exactly what you want to accomplish.
    --- didn't expect to see so many replies so quickly ---
    Most people recommend converting the numeric array to string array first.  I offer an alternative   or a choice of both.. 
    Attachments:
    exampleOfWriteDiffArrayToSprdsht.png ‏28 KB

  • Array To Spreadsheet String -- Convert EOL Option

    The Array To Spreadsheet String and Spreadsheet String To Array functions should provide an option for (not) converting EOL (end-of-line) to platform-dependent ones. I am thinking of something similar to the Write/Read Text File options where you can place a checkbox in the context menu "Convert EOL". As per default such checkbox need to be checked for compatibility reasons.
    Possibly another option/checkbox for not appending the final EOL would be nice, maybe "Final EOL" checked per default as well.

    Hi aschipfl,
    some thoughts about your suggestion:
    - When you want to suggest improvements to LabVIEW you should post in the Idea Exchange.
    - NI will not change the behaviour of functions existing for a long time…
    - NI will probably update the LabVIEW help for that function…
    - a spreadsheet string needs some kind of delimiter, what's the purpose of creating a spreadsheet string without them?
    When you really need a "Array to Spreadsheet String" without delimiters you could take this approach:

  • Having trouble converting array to spreadsheet string, storing the file and coverting back to array with complex numbers

    I am working with a network analyzer. I have arrays made of 5 columns the first consisting of an integer and the next four consisting of complex numbers. I am converting the array into a spreadsheet string and then saving the file using the write characters to a file VI. That seems to work well as when I open the file in Excel all the data is there. However when I try to reverse the process, open file and convert back to array, I loose some of the data. Specifically the imaginary parts of my complex numbers are all going to zero. I have narrowed down the problem to be in the conversion from spreadsheet string to array and vice versa. I
    think the problem may be with the 'format' input to the VI. I do not have an adequate resource for this so I am not sure what to put in to accomplish my task. Any takers?

    Hi Biz
    I don't think there is a direct way of converting a complex number to a
    string, so when you convert the array to a spreadsheet string, the
    numbers would be converted to real data.
    However, you could try separating the real and imaginary parts using the
    "Numeric: Complex to Re/Im" function, and then store these - either in
    separate files or in adjacent columns/rows in the same file. Then, when
    you read in the data again, use the "Numeric: Re/Im to Complex" function
    to put the two "halves" together.
    If you actually want Excel to interpret the numbers as imaginary, then
    you'll probably want to create a string for each complex number of the
    form "Re + Im*i" (after separating the Re and Im parts), by using
    "String:Format into String" with 2 numeric inputs and the format string
    "%f+%fi".
    Reading the data back into Labview then would require splitting the
    string into the 2 pieces by using "Stringcan from String" with 2
    numeric outputs (smae precision as original numbers specified by the 2
    Default Value inputs) and the same format string "%f+%fi", and then using
    the above-mentioned "Numeric: Re/Im to Complex" function. It worked for
    me, so if you can't follow what I am describing, send me an email and I
    can email you what I did (LV 5.1.1).
    Paul
    Biz wrote:
    > Having trouble converting array to spreadsheet string, storing the
    > file and coverting back to array with complex numbers
    >
    > I am working with a network analyzer. I have arrays made of 5 columns
    > the first consisting of an integer and the next four consisting of
    > complex numbers. I am converting the array into a spreadsheet string
    > and then saving the file using the write characters to a file VI. That
    > seems to work well as when I open the file in Excel all the data is
    > there. However when I try to reverse the process, open file and
    > convert back to array, I loose some of the data. Specifically the
    > imaginary parts of my complex numbers are all going to zero. I have
    > narrowed down the problem to be in the conversion from spreadsheet
    > string to array and vice versa. I think the problem may be with the
    > 'format' input to the VI. I do not have an adequate resource for this
    > so I am not sure what to put in to accomplish my task. Any takers?
    Research Assistant
    School of Physiotherapy, Curtin University of Technology
    Selby Street, Shenton Park, Western Australia, Australia. 6008
    email: [email protected]
    Tel. +61 8 9266 4657 Fax. +61 8 9266 3699
    "Everyone who calls on the name of the Lord will be saved." Romans 10:12
    "For all have sinned and fall short of the glory of God, and are
    justified freely by his grace through the redemption that came by Christ
    Jesus." Romans 3:23-4

  • Writing 2-D array to spreadsheet file changes value of time column when saved

    I have a program that creates a new row in a table each time the loop performs.  Each time the loop performs and a row is added to the table, the program uses the "write to spreadsheet file.vi" to save this new table over the previous table.  The array is also visible on the front panel of the vi.  The program works in such a way that you can stop adding data to the array, start adding data to a new array, then come back to the original by using the "read from spreadsheet file.vi".  My problem comes after opening the spreadsheet file.  The first column of the array, which corresponds to the time when the data in that row was taken, has different values than those that were seen when the array was originally displayed on the front panel.  In fact, all of the rows that were created the last time the program was run with that array have the same value in the time column, while all of the other columns keep their correct values.  Here is an example of what is happening...
    When I start the program, and run it for 5 iterations, I get a table like this displayed on the front panel:
    3241713920
    85.88012
    93.88012
    1.735015...
    3241713930
    85.97603
    93.97603
    1.747003...
    3241713940
    84.58855
    92.58855
    1.573568...
    3241713950
    84.48096
    92.48096
    1.560119...
    3241713960
    84.93667
    92.93667
    1.617084...
    This array is saved to the spreadsheet file with each added row.  If I initialize and build another array, then come back to this first array using "read from spreadsheet file.vi," I will receive the following table:
    3241713920
    85.88012
    93.88012
    1.735015...
    3241713920
    85.97603
    93.97603
    1.747003...
    3241713920
    84.58855
    92.58855
    1.573568...
    3241713920
    84.48096
    92.48096
    1.560119...
    3241713920
    84.93667
    92.93667
    1.617084...
    If anyone could tell me why this is happening and/or how to fix it, that would be greatly appreciated.  One option I have contemplated is just having each individual row appended to the file instead of resaving the entire array with each iteration.  However, I would prefer to do it the way I am currently doing it, so I can pass the array through each time and perform different tasks on it, such as averaging the values in columns over different time periods.  Thank you in advance to anyone who can help. 

    DWDerr wrote:
    If anyone could tell me why this is happening and/or how to fix it, that would be greatly appreciated.  ...
    This KnowledgeBase article may help.  I think things changed in LV8.20, but I could be wrong.
    =====================================================
    Fading out. " ... J. Arthur Rank on gong."

  • Save waveform data with corresponding time array to spreadsheet file

    Hello to all
    I am looking for a possibility to save voltage data acquired and displayed continousely to a spreadsheet file. Acquiring and displaying is not a big problem, but I have troubble to save the data with the corresponding timestamp with more than seconds accuracy. I am acquiring the data at 1000 Hz and read packages of 500 samples. The recording time should not be limited, it will be started and stopped manually. In fact the acquired voltage data first has to be scaled and than saved. If I use the 'WRITE WAVEFORM TO SPREADSHEET' VI the time column is in seconds' accuracy and that is not what I need. If I create my own time array from the waveform parameters I have timing problems. The accuracy in time should reflect the sample rate. I will attach one of my not very successful trials for better understanding.
    please help a newcomer!
    Thanks in advance
    Thomas
    LV 7.1
    Attachments:
    display & record forces v.1.0.vi ‏181 KB

    I usually follow a simple method to generate time stamp
    I keep sampling rate and number of samples to read as equal and do as shown in the attached VI
    I also remember building a VI with a small modification to this time stamp generation logic to cater to acq, where number of samples to read is half/one fourth/one tenth of sampling rate specified, but cannot find that VI.
    Hope this helps
    Regards
    Dev
    Attachments:
    Acq_DAQmx_filesave_time stamp.vi ‏121 KB

  • Writing data to spreadsheet with time stamp

    Hi
    I am in the process of making a data logger using FPGA DMA FIFOs to read analog inputs into a real time host vi. This vi then queues the data to a second, lower priority loop. It is my goal that at this stage the data will be written to a spreahseet somehow with a usec-accurate timestamp as the first column, and all relevent column headings etc
    I have uploaded my project as a zip for your viewing.
    Thank you all for your help!
    Attachments:
    HS DAQ.zip ‏656 KB
    HS DAQ.zip ‏656 KB

    Have you tried using the Get Date/Time in Seconds to return a timestamp for your data which you could then build into an array with your data?  You could then write this data to a spreadsheet file if you like.
    Kind Regards,
    Robert Ward
    Applications Engineer, NI

  • Writing arrays in to excel

    Helo..
    I have sampled sine and cosine waves (4096 samples)  and the sampled values are in two different arrays. How can I write those arrays in to two different columns in excel sheet. I am using labview 8.2.
    post the appropriate vi. 
    Thanks in advance. 
    Solved!
    Go to Solution.

    Not to beat a dead horse, but this method will not work, or not work well, in some cases.  For example, you can't use the write to spreadsheet file function if you want to  write to a specific worksheet within a workbook.  Also, the "Write Table to XL" VI is extremely slow for writing large chunks of data - it's writing data cell by cell so that can eat up processor time as the spreadsheet grows. 
    A more efficient way is to use the "Value2" method of the ActiveX Range object.  This way you can write a huge set of data to Excel in a second or two.  I've attached a simple version of a VI I use as an example.
    Greg
    Certifed LabVIEW Developer
    Attachments:
    Write 2D array to Excel.vi ‏12 KB

Maybe you are looking for

  • How to reuse a table style in Numbers 3.0

    I can save a Numbers Table Style in one spreadsheet, but I've no idea how to open and use the saved style in another spreadsheet. When I save the style it shows up in the inspector for that document, but does't appear in the inspector when I open ano

  • Password problem on Catalyst 3750

    Hi all, I am an Unix administrator and we lost all account and password informations to connect on a Catalyst 3750 switch. Is there a way to connect to the switch (With a serial cable?) an to create a new account without losing the configuration ? Th

  • DIY Network

    What happened to the DIY Network?  It's  missing from the Itunes Store in Networks & Studios.

  • Database DOWN due to ORA-1092

    I have Oracle 9.2.0.5 running on Windows 2000 SP4. After a cluster failover, the DB will not start and has following messaeg at end of alert log. Any suggestions how to solve the issue? Database Characterset is WE8ISO8859P1 Failure to extend rollback

  • XPath expression test possibilities in Fault Policy file

    Hi All, It would be a great help if someone can show me a way to implement the next case: I have the next scenario, in a fault policies file I have different actions to execute for the same fault andI have to choose what action will be executed check