Jump to content

Null rows in write to textfile


Wilroy

Recommended Posts

Hello LAVA,

I have four analog voltage signals coming into an SCB-68 and a PCI-6259 M. I would like to sample the four signals at 10 ksamples per sec, for a duration on the order of a couple of minutes.

I use a DAQmx read and Export_Waveforms in a while loop, as shown in the attached image (Acq.jpg).

I find there are blank rows distributed through out the output file, as shown in the attached image (Textfile.jpg). These blank rows have zero values associated with them that are undesirably inserted into the acquired signals. It seems a null row is inserted at every iteration of the while loop. The frequency of null row occurrence and number of null rows per occurrence seems to depend on sampling rate and loop execution time (experimented with putting Wait_until_next_ms_multiple in the loop).

Suggestions on how to remove these rows with null values would be greatly appreciated.

I am running LabVIEW 8.5.1 on XP.

Cheers,

Wilroy.

Link to comment

It's a waveform data serialization VI, you'll find it in the Waveform :: Waveform File I/O palette. The code below illustrates your problem, it will generate five newline sequences in the file specified. Note I'm supplying no waveform data to the VI.

post-11742-1218814491.png?width=400

What happens in your example is your read VI is returning however many samples are ready in your input buffer, which could be zero if you read too fast (this is because of the -1 value supplied to Number of Samples per Channel) . The VI will happily return an empty waveform when the buffer is empty, and in response to this, the serialization VI will write a blank line to disk.

You can mitigate this by requiring the loop to obtain a certain number of samples, checking for an empty waveform, retrieving only the number of samples in the buffer, or whatever works best for your situation.

-michael

Link to comment

It's actually a problem of the Export Waveforms To Spreadsheet File itself (I looked at the 1D polymorphic instance of it, haven't checked the others).

With every call, it writes one row of (empty) data to many.. I think the problem is the Incr function (see attached picture), although I haven't checked if it would break other functionality of the VI if it would be removed.

post-906-1218877894.png?width=400

Question to NI would be, is this expected behaviour or is it a bug. I would think the latter.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.