LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

lvm file to array

Solved!
Go to solution

Before I start, I have to confess, I'm relatively new to LabVIEW.

 

My Problem is the following: I want to read data from a lvm-file into an array, and then work on this array. Unfortunately, I did not really understand how to use/work on the data coming from the Read from Measurement File VI; it's the same with data coming from an external device (using daqmx assistant). I finished the First Steps-Tutorial offered by LabVIEW (in the german version, but I don't think there is a big difference), and I tried to find something in the help, but I found nothing. I'd appreciate every kind of help; I think the most useful would be a hint where I can learn more or a good solution how to save the lvm file content in an array.

 

As I wrote above, I'm a LabVIEW beginner. But I've used some "normal" programming languages like Python or PHP before; so maybe I am not even thinking the labview-way? The original problem is that the lvm-file contains measurement datas, and I want to split them. There is one column taking values from 1 to 360, and that repeats ([1, 2, .. 360]; [1, .., 360]; [...]). I want to divide the data into the sections marked with [] in this example so I can examine each section separately. I thougt I could use an array where array[0][...] contains the first section and so on, to describe it in the PHP way. If there is a better solution in LavVIEW, please tell me!

 

Thanks in advance, and I hope you were able to understand my post.

 

mkrtwo

0 Kudos
Message 1 of 6
(6,401 Views)
Solution
Accepted by topic author mkrtwo

I suspect the problem you are having is that the Read From Measurement File returns that garbage dynamic datatype. To this day I have yet to hear from one person who has found it to be useful. In order to work with it "for real" you need to convert it to ... well, a real datatype. You can use the Convert From DDT function to do this. In your case you'd want a 1D array, since you said you have just one column. You can then use Reshape Array to get yourself a 2D array of 360xN. What you do from there is kind of up to you. You could, for instance, drive a for-loop directly from this 2D array and each iteration you'd get a chunk of 360 elements in a 1D array (autoindexing does rows first).

Message 2 of 6
(6,396 Views)

This thread should help you in understanding how to read LVM data. The express vi that reads the LVM data has dynamic data type output. You can convert from dynamic data type to array of scalers (or anything else, based on actual data type of the data stored) using 'convert from dynamic data' tool in signal manipulation section of functions palette.   

    Once you have data extracted from lvm file in arrays, you can use various functions such as 'array subset' to saperate the desired data. There are plenty of discussion topics that might be of some interest to you understanding lvm.

Hope it helps.

 

 

-Nilesh

     



------------------------------------------------------------------------------------------------------
Kudos are (always) welcome for the good post. 🙂
Message 3 of 6
(6,395 Views)

Thank you for your answers! It helped me a lot; I did not understand the express VI gives me a ddt..

 

But I encountered a new problem:

Reading data from the lvm-files and converting it from ddt into an array only gives me 100 rows, but I need to read much more..

Is it possible to read everything at once? I am separating the data in a for-loop, using registers to build the new array I need, so I think that would be the easiest way to convert it (unfortunately I can't use the array functions).

 

Edit:

I discovered I can increase the amount of data in the configure-window for Read from Measurement File VI (changing retrieving segments to 1000, I hope it is the correct translation; I am using the german version of labview) but can I choose something like "retrieve all rows"? I don't know exactly how many rows files I use will have..

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

The Convert From DDT function does not limit the number of elements. This is controlled by the Read From Measurement File. Specifically, from the Segment Size option. The first option, Retrieve segments of original size should return all of them. Please read the Help for that function.

0 Kudos
Message 5 of 6
(6,358 Views)

I choose the first option Retrieve segments of original size and for some reason this returned only 100 elements.

 

But that is no more important, because at the moment I am trying to read every single row separately because I realised the files I have to use are too big to be read completely at once. So thank you for your quick answer!

 

Is there a way to trigger the VI to give me the next signal? I did not find how to do this in the help (I chose Retrieve segments of specified size and set samples to 1). Okay, found it.

0 Kudos
Message 6 of 6
(6,356 Views)