LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Analog Channel data herding

Solved!
Go to solution

Sorry for what may seem to be a fundamental question: I want to specify where an Analog channel ends up in the data file, column wise. Right now I'm dealing with 4 channels, 0,1,2,3 and the data file acquires them in columns from left to right, 0,1,2,3.

 

I want to be able to switch 2 and 3 as they are written to the file, using a control on my FP. So..0,1,3,2. I'm using "write to measurements" and my signals are voltages. Any ideas?

0 Kudos
Message 1 of 9
(3,482 Views)
Solution
Accepted by topic author glskinner

If you have three separate waveforms, you can combine them using Build Array as follows:

 

reorder.png

reorder2.png

 

If you acquire all waveforms as an N-dimension array (i.e. from the same analogue input task) you can index the array and proceed as above.

 

Edit - point being, it's the order in which the array of waveforms passed to Write to Measurement File is built that determines the order in which they'll be saved in the output.

---
CLA
Message 2 of 9
(3,472 Views)

where would I implement that in my code? Right before they're sent to the writetomeasurements.vi?

0 Kudos
Message 3 of 9
(3,466 Views)

Anywhere between generating the waveforms and saving them to the LVM file would do, seeing as elsewhere you search your waveform array for the channels you want to work with and the order is not important.

---
CLA
0 Kudos
Message 4 of 9
(3,455 Views)

Another lesson learned. I'll try this! Thanks!

0 Kudos
Message 5 of 9
(3,445 Views)

A couple of other points from a quick look at your code:

 

- Your DAQ initialisation is inside the while loop. You only need to set this up once, outside the while loop.

- Hide labels on the front panel rather than making them blank. This way you can still read them on the block diagram.

- Wean yourself off dynamic data as soon as you can. There's an unnecessary convert to dynamic data type and build XY plot. You can do the same with the arrays of doubles, bundling into a cluster and then wiring to an XY graph.

- Be careful of code creep. You've got a relatively simple VI which spans about eight screens on the block diagram. This makes following code a little difficult. Using a few simple techniques, such as using sub VIs and/or a different system architecture, you can do the same in a manner that's far easier to follow.

 

Don't worry about the last point - you'll get there in the future 🙂

---
CLA
Message 6 of 9
(3,438 Views)

Thank you for the pointers, I've only been doing this for a 2-3 months but these forums are giving me incredible insight!

0 Kudos
Message 7 of 9
(3,423 Views)

How exactly do I use a non-dynamic data type for my waveforms?

0 Kudos
Message 8 of 9
(3,374 Views)

Hi glskinner,

 

You can use a cluster instead of a dynamic data type.  Please take a look at the following document and it should show you what you can do to build a waveform out of an array.

 

Using the Waveform Data Type in LabVIEW

| Zach J. | Systems Engineer, HIL and Test Cells | National Instruments |
0 Kudos
Message 9 of 9
(3,351 Views)