LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Samples number is not properly set with VI Express Write To Measurement File

Hello,

I have a strange problem with the VI Express Write To Measurement File.
When I generate the .lvm file the samples number for each channel is equal to 1
instead of 34 !
So when I use the VI Express / Input / Generate an arbitrary signal and I want to import
the generated signal... only one point (the first one) is imported...
I can manualy fix it by changing samples number in the lvm file using a text editor but that's a (very) dirty hack !


Here is an example of the generated LVM file

LabVIEW Measurement   
Writer_Version    0.92
Reader_Version    1
Separator    Tab
Multi_Headings    No
X_Columns    One
Time_Pref    Absolute
Operator    scls
Date    2008/04/12
Time    10:35:58,322057
***End_of_Header***   
   
Channels    2       
Samples    1    1   
Date    2008/04/12    2008/04/12   
Time    10:35:58,323057    10:35:58,323057   
X_Dimension    Time    Time   
X0    0.0000000000000000E+0    0.0000000000000000E+0   
Delta_X    1.000000    1.000000   
***End_of_Header***           
X_Value    Untitled    Untitled 1    Comment
0.000000    0.000000    20.000000
0.082000    10.000000    20.000000
0.182000    10.000000    25.000000
0.282000    20.000000    25.000000
0.382000    20.000000    30.000000
0.482000    30.000000    30.000000
0.582000    30.000000    35.000000
0.682000    40.000000    35.000000
0.782000    40.000000    40.000000
0.882000    50.000000    40.000000
0.982000    50.000000    45.000000
1.082000    60.000000    45.000000
1.182000    60.000000    50.000000
1.282000    70.000000    50.000000
1.382000    70.000000    55.000000
1.482000    80.000000    55.000000
1.582000    80.000000    60.000000
1.682000    90.000000    60.000000
1.782000    90.000000    65.000000
1.882000    100.000000    65.000000
1.982000    100.000000    70.000000
2.082000    110.000000    70.000000
2.182000    110.000000    75.000000
2.282000    120.000000    75.000000
2.382000    120.000000    80.000000
2.482000    130.000000    80.000000
2.582000    130.000000    85.000000
2.682000    140.000000    85.000000
2.782000    140.000000    90.000000
2.882000    150.000000    90.000000
2.982000    150.000000    95.000000
3.082000    160.000000    95.000000
3.182000    160.000000    100.000000
3.282000    170.000000    100.000000


PS : I also post my problem at
http://forums.lavag.org/Strange-behaviour-of-VI-Express-Write-LVM-t10570.html&gopid=44101#entry44101

0 Kudos
Message 1 of 5
(3,438 Views)

I think the problem is with the way you are using the function. On the first iteration, you have a sinlge sample for each 'channel'. This information is written to the header and then the data is written. You have configured the express VI to write only a single header (Segment Headers>One header only). So, the second iteration, just the data is written. The information in the file is correct. You do only have a single sample. What you see in the file are really considered multiple segments.

I'm not sure there is an easy fix if you use the Express VIs aside from using the one header per segment option. I never use the epxress VIs. There is considerable overhead with the Write to Measurement File so you might be better off just using the low level file write functions and not using the Read From Measurement File either.

Message 2 of 5
(3,419 Views)
If I use the "one header per segment" option I get the following LVM file (see below)
But the problem is same !
I can't import this file in VI Express / Input / Generate Abitrary Signal (I only get one row... the first one)

I see three solutions :
- VI Express Write LVM has a bug ?
- I don't know how to use this VI Express correctly !
- VI Express / Input / Generate Abitrary Signal has a bug ?


LabVIEW Measurement    
Writer_Version    0.92
Reader_Version    1
Separator    Tab
Multi_Headings    Yes
X_Columns    One
Time_Pref    Absolute
Operator    scls
Date    2008/04/12
Time    16:38:37,578
***End_of_Header***    
    
Channels    2        
Samples    1    1    
Date    2008/04/12    2008/04/12    
Time    16:38:37,592999    16:38:37,592999    
X_Dimension    Time    Time    
X0    0.0000000000000000E+0    0.0000000000000000E+0    
Delta_X    1.000000    1.000000    
***End_of_Header***            
X_Value    Untitled    Untitled 1    Comment
0.000000    0.000000    20.000000

Channels    2        
Samples    1    1    
Date    2008/04/12    2008/04/12    
Time    16:38:37,717    16:38:37,717    
X_Dimension    Time    Time    
X0    1.3899993896484375E-1    1.3899993896484375E-1    
Delta_X    1.000000    1.000000    
***End_of_Header***            
X_Value    Untitled    Untitled 1    Comment
0.139000    10.000000    20.000000

Channels    2        
Samples    1    1    
Date    2008/04/12    2008/04/12    
Time    16:38:37,739999    16:38:37,739999    
X_Dimension    Time    Time    
X0    1.6199970245361328E-1    1.6199970245361328E-1    
Delta_X    1.000000    1.000000    
***End_of_Header***            
X_Value    Untitled    Untitled 1    Comment
0.162000    10.000000    25.000000


and so one ...
0 Kudos
Message 3 of 5
(3,413 Views)

I don't think it is a bug in the Write to Measurement file. The data looks correct. The Generate Arbitrary Signal probably doesn't have a bug either. What I think the problem is that the Express VIs are designed to be quick and easy to use in a limited number of applications. The typical use of the Write to Measurement File is to save data from a data acquisition with mulitple samples. The Generate Arbitrary Signal import function was designed with this in mind. It probably never occured to the author of the Express VI that someone would be trying to import a file with multiple segments. Or, if it did occur to the author, that the number of users doing this would be small and didn't want to add a lot of complexity to the program.

Besides the other suggestions I made about using the low level file functions, you can place the Write to Measurement File outside your loop and do a single write. Wire the data through the while loop and on the exit tunnel, select Enable Indexing. This will create an array of values. Now, when you use the Write to Measurement File, your number of samples will be correct and you will have a single segment that can be read by the Generate Arbitrary Signal function.

 



Message Edited by Dennis Knutson on 04-12-2008 09:19 AM
Message 4 of 5
(3,409 Views)
Thanks a lot !!!!!
It works fine.
I never used "Enable Indexing" before.
Now, I know why you are "
Knight of NI"

Best regards

Sébastien
0 Kudos
Message 5 of 5
(3,397 Views)