LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to get the time from a file recorded?

Solved!
Go to solution

Well guys, I recorded some files at LabVIEW with my program, but now I need to show at Front Panel

the time at the begging of the file

and the time at the finish of the file

 

like this file beggin 1:30pm

this file end 1:33pm

 

Someone could help me on that? I'm using the Write file [+I16] to make my file

and labview version 7.1 

 

Thanks

0 Kudos
Message 1 of 22
(3,565 Views)

Hi EduU,

 

for the file end you could maybe check the file's "last mod" time given by "File/Directory Info" function.

When you have a constant sampling time you could then calculate the start time of file writing.

 

Maybe it's now time to redesign your file format? Maybe including some header information? Like start of measurement, type of, sampling rate, etc... Smiley Wink Usually you have to think about that much earlier, right after reading the functional requirements of the programming contract...

Message Edited by GerdW on 04-12-2010 05:17 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 22
(3,561 Views)

Hey GerdW, thanks for the help

 

My file already have some header but not those.

But thanks for the help I already  get the time of the begging file...

and with your help I will get the time of the end of file

so I have all I need now =D

 

I will try here, and post later with it works!

 

Thanks

0 Kudos
Message 3 of 22
(3,558 Views)
Well GerdW, The last mod works now I Know the end of my file
but how can I show the beggin of the file?

Thanks
0 Kudos
Message 4 of 22
(3,533 Views)

Hi EduU,

 

I'm not sure Smiley Wink I thought you already got the start time of the file?

 

Suppose you have constant intervals between saving data items: then you could get the file length (amount of data), divide by the data item size to get the number of data items. Now you could mutiply number of data with interval to get the whole "file time"...

 

Or you could change the data header before saving new files Smiley Wink

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 22
(3,517 Views)

Well GerdW,

 

I dont have the start time x( I think I had it but when I saw it's the end of file already

Yes I record to file it from 2 seconds... like 2 4 6 8 10....

but I don't know how to make it take the amount of data and divide for the number of samples....

 

could you attach an image for me?

 

and don't have any other way, more easier?

How can I make that at header??

 

Thanks

0 Kudos
Message 6 of 22
(3,495 Views)

Hi EduU,

 

it's kind of pure math:

Suppose you write an I32 each 2 seconds. Your file end is at 12:00:00 and the file has a length of 100 I32 values (=400 bytes). Then the file start is at 12:00:00 - (100*00:00:02) + 00:00:02 = 11:56:42. Pure math...

 

How to make header: you could first write some text lines containing needed values (like start time and sampling frequency). Then you mark the beginning of the data section (like "DATA:") and start to write your actual data... Anything is possible (depending on your requirements)!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 22
(3,489 Views)

Well,

 

Have some VI that gives me the number of I32 interations??

 

and at header, could you attach a image showing me how to make it?

like values needed: time and samples only a simple example

so I can understand better and adapt to my program!

 

Thanks

0 Kudos
Message 8 of 22
(3,485 Views)

Hi EduU,

 

number of I32 = data length (in byte) divided by 4 byte/I32.

 

The file length is also given by "File/Dir Info"...

 

Right now it's only guessing from my side. You have to know the file content and it's formatting. Once you know that (and suppose it's a rather simple file layout) you can easily calculate all needed values. But it's up to you!

 

File example:

*** start of file ***

HEADER:

start=12:34:56

sampling=00:00:02

name=Test measurement

...

DATA:

1234,5678,9012,...

*** EOF ***

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 22
(3,473 Views)

Well, my program works with I16 so its

 

number of I16 = data length (in byte) divided by 2 byte/I16.  ??

 

like I have a length of 100000 bytes so I have

 

100000/2 = 50000 I16?

0 Kudos
Message 10 of 22
(3,466 Views)