08-20-2010 10:04 AM
Hi,
I have different Sin wave(with different frequencies: 4.3 KHz, 8.4,13.3,17.55 KHz
). I wanna to acquire these signals and write the data points in a LVM file. For this reason I use 200KHz for Rate but with DAQ assistant give me error 200279. I tried to read data more frequently and change buffer size manually. You can see the final file that I have in the attached file . But this file just write for me for 0.0001sec. When I change the rate in this file to 200000, it writes data just for 1 sec and after that gives the minus data for time.I don't know how I can solve this problem.
Marmar
08-20-2010 01:21 PM
Please someone give me a solution.
08-20-2010 09:56 PM
Writing data to a file takes longer than the data you have coming in is acquired. So by the time the data is written to the file, the buffer has already overrun in the DAQ acquisition task. Particularly if you are only acquiring a 1000 samples at a 200kHz rate, that is a small fraction.
You should look at Producer/Consumer (search the forums and look under File / New.... templates). There you pass the data off from the acquisition loop to a file writing loop by way of a queue. You should also acquire a larger number of samples in each acquisition to make an efficient sample of data to pass to the file writing loop.
In the end, if you still have a hard time with the file writing keeping up with the acquisition since that loop will run slower, you should look at saving the data in a binary file format such as TDMS rather than saving to a text file which is a much less efficient way of storing data.
08-23-2010 10:39 AM
The LVM format is not designed for high-performance logging. You might want to try TDMS instead.
Herbert
08-23-2010 11:00 AM
Hi Herbert,
Thank you so much.
I did it and it's ok.But the problem is importing the TDMS file to Matlab. With LVM file I didn't have any problem. For TDMS I am using a Matlab function (
Function to load LabView TDMS data file(s) into variables in the MATLAB workspace.%An *.MAT file can also be created. If called with one input, the user selects%a data file. This function was submitted to MATLAB Central's File Exchange by%Robert Seltzer on 15 JUL 10 (File ID #28212))That the structure gives me just the data for one channel(I have data for six channel).I couldn't attach the function here. It gives me the error that the extension is not valid.
Thanks again,
Marmar
08-23-2010 11:10 AM
08-23-2010 11:25 AM
Thank you Herbert,
I tried it before but it gives me error
Error in ==> ReadFile at 30loadlibrary(NI_TDM_DLL_Path,NI_TDM_H_Path);
Marmar