03-21-2016 01:17 PM
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
03-21-2016 01:29 PM
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.
03-21-2016 01:48 PM
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.
03-21-2016 02:15 PM
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
03-21-2016 02:18 PM - edited 03-21-2016 02:21 PM
"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:
03-21-2016 06:47 PM
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