LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

saving 3 channel data

Hi,
I have a VI, which saves 3 channel data .I have a push button called marker.When marker button is pressed it will be saved in a text file as 1 if it's not pressed it will be saved as 0 .You can find the VI�s picture and saved data called 1 attached.
The problem is when I simulate this vi with random numbers everything is ok.Buy when I acquire 3 channel data- my sampling rate is 1300 and number of sample is 440-as you can see in the picture called 2 data comes as # 433 for each channel. Thus, as you can see in the txt file called 2 everything is mixed up.What should I do to save 3 channel acquired data as the simulated one.
Thanks
Download All
0 Kudos
Message 1 of 9
(2,882 Views)
In your simulation you are saving single values. In the DAQ Vi you are saving arrays of values. Only one timestamp is saved for each array (the #443 values). This is what your images and the data appear to show. It is not clear from your question what you want it to do. Please try to clarify.

Lynn
0 Kudos
Message 2 of 9
(2,882 Views)
I'm trying to save data like saved data 1. But it saves my daq data as I attached below called daq save.
How can I save my daq data like saved data 1?
Thanks
0 Kudos
Message 3 of 9
(2,882 Views)
To save one line at a time, you need to index the arrays of data. Enclose the formatting, timestamp, marker and the Write to File inside a for loop. Pass the data arrays into the loop via autoindexing tunnels. This will result in 433 writes. An alterantive to avoid many repeated writes to file is to build a large string by using a shift register and Concatenate Strings function inside the for loop and have the Write to File outside the loop. This approach will write the 433 lines to the file simultaneously.

Lynn
0 Kudos
Message 4 of 9
(2,882 Views)
I don't want to repeat writes to file. . How can I build a large string by using a shift register and concatenate string function? Enclosed please find the vi (only the marker part).Would you please help me.
Best Regards
0 Kudos
Message 5 of 9
(2,882 Views)
Here is a modified version of your VI which creates the large string and writes to the file once per acquistion.

Lynn
0 Kudos
Message 6 of 9
(2,882 Views)
Dear Lynn,
Thanks for your help. I have one last question. How can I combine marker2.vi with my daq vi? I've tried to do it but I couldn't. You can find daq vi attached. I use ADAC daq card. Thus, If you can't run the programme you can look at the jpeg. I've tried to put for loop outside the daq's while loop but it didn't work. What do you recommend.
Thanks a lot
Download All
0 Kudos
Message 7 of 9
(2,882 Views)
Dear Lynn,
In my previous message I asked how to combine vi's . But I've achieved this. Here is the picture of vi attached. But now the problem is, it saves number of 433 data for the same second.Thus, there is approximately 4 seconds delay betwen the first 433 data group and the second 433 data group.You can find the excel file for saved data below. How can I match the exact time for each 433 data?
Thanks
Download All
0 Kudos
Message 8 of 9
(2,882 Views)
If you know the sampling rate of your DAQ equipment, you can create an estimate of the sample times. You do not know the start time of the 433 sample group (although you may know the time your trigger the DAQ). What you know is the time you receive it from the DAQ. The time between samples = 1/sample rate = Ts.
The time you receive data array from DAQ = Tlast.
Number of samples = N.

Then the time of sample i, ti, is

ti = Tlast - (N-1-i)*Ts

If you know the trigger time and the latency between triggering and the first sample is small, use

ti = Ttrigger + i*Ts

Lynn
0 Kudos
Message 9 of 9
(2,882 Views)