LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write Muliple Signals using Write to Measurement file

Hi Everyone,

 

I would like to write 2 different channels using Write to Measurement file.vi. I expect to get something like this:

 

X_Value   Untitled   Untitled 1

0    0.56   0.35

1    0.36   0.75

2    0.28   0.95

3    0.65   0.64

4    0.86   0.76

...

 

n   0.25    0.85

 

But I get something like this: 

Channels 7
Samples 2 2 2 2 2 2 2
Date 2013/08/05 2013/08/05 2013/08/05 2013/08/05 2013/08/05 2013/08/05 2013/08/05
Time 22:59:08.2775259017944335938 22:59:08.2775259017944335938 22:59:08.2775259017944335938 22:59:08.2775259017944335938 22:59:08.2775259017944335938 22:59:08.2775259017944335938 22:59:08.2775259017944335938
X_Dimension Time Time Time Time Time Time Time
X0 0.0000000000000000E+0 0.0000000000000000E+0 0.0000000000000000E+0 0.0000000000000000E+0 0.0000000000000000E+0 0.0000000000000000E+0 0.0000000000000000E+0
Delta_X 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
***End_of_Header***
X_Value Untitled Untitled 1 Untitled 2 Untitled 3 Untitled 4 Untitled 5 Untitled 6 Comment
0.000000 0.908603 0.704951 0.083706 0.137180 0.583941 0.570922 0.290578
1.000000 0.913171 0.130467 0.855265 0.333351 0.278039 0.196711 0.172709
0.000000 0.537660
1.000000 0.408266
0.000000 0.537660 0.227937
1.000000 0.408266 0.125044
0.000000 0.537660 0.227937 0.042015
1.000000 0.408266 0.125044 0.334553

 

If you view the attached VI, you can see that I created a 2D array using random.vi, and then write the 2D array to files by Write to Measurement file.vi. The results say that I have 7 channels, and 2 samples. However, I have 2 channels and 7 samples. What is the problem with my code? Could you please help me? Thank you very much!!!

0 Kudos
Message 1 of 7
(5,169 Views)
--> Write to Measurement file.vi shouldn't be kept in loop (as it is configured to append the data, so in every next iteration of loop, this Express VI will keep appeding the data)
--> You should transpose the 2D array, as every row is a channel (I figured it out after seeing the data file Smiley Wink)
--> Two loops aren't required, so removed.
--> Don't use ABORT button, instead use STOP boolean (otherwise, as the Write to Measurement file.vi kept outside loop will not execute).
--> To remove the header, you can configure it in Express VI setting as shown below.
No Header

 


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


0 Kudos
Message 2 of 7
(5,144 Views)

No.  With the "write to file" outside teh loop, the data apprently only gets written when the loop stops running and you only get a finite number of samples.  When you place it inside, appending the data causes a header to be written for each time through the loop and the data is not stored continuously.

0 Kudos
Message 3 of 7
(5,130 Views)

Why not use Write to Spreadsheet File instead of Express VI? 

 

Example.png

 

Output

 

0 Kudos
Message 4 of 7
(5,120 Views)

Thank you very much for your reply. It is really helpful. The only concern is what drneil said above. I feel like I am not collecting the data continuous if I put the Write to Measurement file.vi outside the loop. But if it is inside the loop, LabVIEW treats each row as a channel,which is not what I want to get. Any new ideas? 

0 Kudos
Message 5 of 7
(5,087 Views)

Yes, you are very right. By putting the Write to Measurement file.vi outside the loop, we are obtaining the data at one time not in a continous fashion. Do you have a better idea? Thank you for your post!

0 Kudos
Message 6 of 7
(5,086 Views)

Thank you for the post! 

 

The two random variables are used to simulate a DAQ process, where I get continous data in the form of 2D array. So, I used the Write to Measurement file. 

0 Kudos
Message 7 of 7
(5,085 Views)