From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Export Waveform to Spreadsheet - Timestamp Issue

Hi there.

Almost total newbie here. I've searched the forums around here for an answer, and i can't find one that explicity states how to do exactly what I need - but i apologise if what I am asking is trivial, or maybe if my description causes you to cringe at how little i understand of LabVIEW.

I was thrown headfirst into LabVIEW a few days back, having never used it before and having only a very limited, basic knowledge of programming from my earlier education, and have succeeded in doing some minor alterations to a program written already, which in a nutshell takes in data from a number of  analogue voltage sensors, goes through a data acquisition box, and is converted to a digital waveform format in LabVIEW (v7.1) periodically.

From what I understand, the program runs using a sample rate and a number of samples specified - in other words for a set time, where it then outputs a timestamp/sensor voltage for each sensor in spreadsheet form. I don't know the entire mechanism but my problem is with this part - exporting it - which is the feature i have added.

What i need is a format for the timestamps in the spreadsheet which begins at zero. Right now, i'm using the Export Waveform to Spreadsheet VI, practically unchanged from its default code. I've put it in, i believe, in the right place, and can run the program to obtain a file readable in Excel, which shows the correct sensor voltages at the correct increments. The changes i have made have been only to change the "Waveform Time to Date String" module to omit the date, and give the time to 6 decimal places.

The final thing i need to do is simply to somehow re-code how the time stamps are written to the exported file. I understand that this works using the parameters "t0" and "dt" which i presume are taken in by some means from the system clock. Since i have chopped off the hours and the date, my spreadsheet shows the minute past the hour, and then the seconds, milliseconds etc. So for example if it was 14:38 at 56.949495 seconds, the header would show 38:56.949495 for that particular sensor reading. What i need is the time to start when the program is run from zero, but still output in this format.

I think it can be achieved by altering the "WDT Get Waveform Time Array" VI used in the "Export Waveform..." VI, but i don't know exactly how.

Is there a simple way to do this?

Cheers for your time,

Liam
0 Kudos
Message 1 of 4
(3,544 Views)

So instead of an absolute time, you want a relative time?

 

You could do something like this:

Time Stamp.PNG

Basically, it breaks up your waveform and only takes the y-value, and uses the dt to create x-values.

It then converts the x-values into the time stamp you specify (the large pink box).

Then it builds a 2D array of x and y values.

Lastly, it writes to a txt file using 'write to spreadsheet file'.

 

I'm not sure if 'Write to spreadsheet file' is polymorphic in 7.1, but I think it accepts string arrays.

Message Edited by Cory K on 06-22-2009 10:07 AM
Cory K
0 Kudos
Message 2 of 4
(3,528 Views)
Hi again,

Thanks very much for your response, it's much appreciated.

I had a go at this yesterday. I made the VI (with the very amateur method of "match up the icons"=D). I suspect there is an issue however with 7.1, as it seemed to flow fine until the output from the Loop was wired to the write to spreadsheet VI - it was an incompatible format for it, for both the 2D and 1D array inputs. This is reflected in the fact i couldn't find the same icon for the write to spreadsheet for the life of me, but i found this VI with a different icon (implying either i have the wrong VI, or it has changed since the version of LabVIEW i am using, but it seems to have the same name). So i guess i'll have to get 8.xx installed and perhaps try to import my program.

Unfortunately i also failed to mention i was taking in an array of Eight waveforms in my current structure (where i just stick the arrray of waveforms into the "export waveform to spreadsheet", where your solution works for a single waveform). The output is currently a column of timestamps and eight columns of corresponding sensor voltages.

Can i preserve this format of a single spreadsheet output, and change something within the Export Waveforms to Spreadsheet VI? Or do i have to split the array of waveforms i get from the data acquisition box somehow, and use your method with a later version to get what i need for each waveform in the array, then copy paste them into the same spreadsheet file?

Thanks again for your kind help, and i'm sorry if didn't understand anything.

Liam
0 Kudos
Message 3 of 4
(3,502 Views)

Someone may have to confirm this for me, but in LabVIEW 7.1, I dont think that the 'write to spreadsheet file' function is polymorphic.

What I mean by this is that, in 8.x, you can input an array of : double, single, integer, string, etc.

The function will adapt accordingly.

 

In 7.1, I dont think you can pass a string.
I will attach a copy of 'write to spreadsheet file' that can accept strings for you.

I can only save down to LabVIEW 8.0, can someone please save this to 7.1 for Dur, thank you.

Cory K
0 Kudos
Message 4 of 4
(3,481 Views)