LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

appending data to binary

Hello,

 

I am currently writing a script to acquire data using a DAQ deivce. I want my script to acquire voltage data from two different channels, concatenate the arrays, then write them to a binary file. I am running into trouble when I attempt to add an elapsed time stamp to the end of the file for reference of how long the data was acquired for. How do I append this final value to its own line in the file? I have attached my script. please let me know

 

thanks,

 

mmoon

0 Kudos
Message 1 of 8
(4,102 Views)

What do you mean by "trouble"? Are you getting an error? What do you mean by "its own line". It's a binary file it doesn't have lines. Maybe you mean a text file?

0 Kudos
Message 2 of 8
(4,090 Views)

Code-wise, I do not see anything wrong with how you are writing the data.  How do you know it is incorrect?  I did not see anything in there for reading the data.

 

Though, a better route would be to write your data to a TDMS file.  In fact, DAQmx can do almost all of your file writing by using the DAQmx Configure Logging VI.  You can then add your elapsed time to the file by writing it to a property of the group that you wrote your data to.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 8
(4,081 Views)

I am also writing a python script that will read in all of the data and i'm not seeing the elapsed time value.

 

Crossrulz, here is my new version of the code so far. I am pretty confused about how to add the elapsed time to the file. Could you possibly show me an example of how to do so

 

thanks

 

Moon

0 Kudos
Message 4 of 8
(4,053 Views)

I don't use TDMS myself, but here is a very informative NI White Paper on it that (among other things) discusses TDMS logging and DAQmx.  Incidentally, I'm very puzzled why you force the output of the DAQmx Read into a pair of Dynamic Wires (note the angry red Coercion dots!) and then combine the two (identical?) signals for the Waveform Chart.  Looks very wrong to me ...

 

Bob Schor

0 Kudos
Message 5 of 8
(4,049 Views)

Thanks for the reference paper, I will take a look at it.

 

For the DAQmx read poor arrangement, do you have any suggestions to clean this part of my code up? I want that section to output two separate voltage readings on to 1 waveform chart continusously during reading

0 Kudos
Message 6 of 8
(4,047 Views)

It's really a piece of cake (un morceau du gateau).  I didn't have a DAQ device handy, so I created a Simulated USB-6009, and created a Task to take data from two Analog inputs continuously at 500 Hz, 500 points.  Here's the VI:

Simple 2-Chan Daq.png

Note that I could have simply used the "known" number of points/channel, but the Property node means I don't need to worry if the Task changes.  Note that the 1D Waveform is exactly the right form for a 2-channel Waveform Chart!  No muss, no fuss.

 

Bob Schor

0 Kudos
Message 7 of 8
(4,037 Views)

@Mmoon wrote:

Crossrulz, here is my new version of the code so far. I am pretty confused about how to add the elapsed time to the file. Could you possibly show me an example of how to do so


Something like this.  Notice that I did some other simplifications to the code as well, like get rid of the unneeded sequence structure.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 8
(4,023 Views)