LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to find the data length in a channel without fully reading the data using a data plugin

I am trying to read data using data plugins (for data type from MATLAB, MDF3, and UFF58, etc) in LabVIEW. The data file contains long time recordings.

 

How can I find the length/duration of the data in a channel without fully reading the data of that channel? I thought it would be a property I can "get", but I just cannot find it.

 

Thanks.

 

Ian  

0 Kudos
Message 1 of 6
(4,110 Views)

When you convert to TDMS, you should add the length property to make the reads go a little faster.  But it is not in there unless all of the data has been read and you keep track of how many samples were read.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 6
(4,101 Views)

I think it also depends on how the other software handles data file, so what is the structure? Maybe those Matlab, etc files already contain some kind of header? Can you check this info in some programming manual?

 

Another option (which is less likely work) can be to check the total file size, and so get the data length. I used to have ANSI C code developed many years ago, where I simply stored 32 bit floating point numbers in binary files without any header info. It was very simple to check the data length: total size in bytes / 4 bytes (it was single prec float) / channel. I only had to convert between little/big endien types so LV could read my C program generated binary data files.

0 Kudos
Message 3 of 6
(4,092 Views)

I will be reading data from different sources with different data format (*.mat, *.uff, *.mdf, *.sdf, *.rsp). That's why I am using data plugins. The length of a signal is not written specifically in some of these files. The data structure can also be a little complicated (mutiple sample rates, headers, etc) , so I will not be able to calculate the length of a signal simply from the file size.

 

I was hoping that there was a "signal length" property I can "get". Otherwise, I can read the channel until it reaches to the end, but it is very inefficient.

 

Thanks.

 

Ian    

0 Kudos
Message 4 of 6
(4,082 Views)

"I was hoping that there was a "signal length" property I can "get"."

LV cannot predict the channel size in advance. Either you need to read the whole channel, or you read the header info if there is any, and if it holds info regarding to the channel size...I beleive many data formats have a header containing this information. Did you check the plugins for these different data formats?

 

edit: Do you know about the NI product: DIAdem? It might be more efficient for what you want to do than only using LabVIEW:

http://www.ni.com/diadem/

0 Kudos
Message 5 of 6
(4,074 Views)

Yes, I did check. Some did have this info on the header, but others did not. Then even for those did, the header info is so inconsistent between files from different sources, it would not work unless I know the header format beforehand. I guess I may have to read the whole channel. This is not too bad. Anyway, I was just hoping :).

 

Yes, I have also seen DIAdem demo at NI before, a very nice tool. But I am building a LabVIEW project this time.

 

Thanks.

 

Ian

0 Kudos
Message 6 of 6
(4,046 Views)