LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Intensity plot with X, Y dimensions not matching

Hi there,


I'm trying to plot an intensity chart (the one that doesn't throw away old values), with x,y and z=f(x,y) (an intensity).  My problem is that the x and y dimensions do not match (they're not supposed to).  The x for loop will iterate 200 times, causing an increment in y, and then repeat (iterate another 200 times), followed by another increment in y, and this continues until y has been incremented 200 times.  For each (x,y) pair, I'm acquiring an intensity, z.  I'd like to plot these values as an intensity plot, but I don't see where I'm going wrong with my code. 

 

Attached is the VI.

 

Thank you

0 Kudos
Message 1 of 4
(2,468 Views)

I see a few things.

 

1.  Each loop should actually be running 201 times.

2.  The intensity graph only needs the 2-D array of Z data.  But you are taking a 1-D array of X values, and a 2-D array Y values that is 201 x 201.  Then concatenating all of them into one really large 2-D array with your actual 2-D array of intensity Z data.

3.  You should not need to restart the task in every iteration of the For Loop.  Just create the task before the program, and kill the task after the outermost for loop.

4.  Since it looks like both channels are on the same device, you should create a single task that contains both channels.  then in each step of the inner most For Loop write your X and Y data for both.

0 Kudos
Message 2 of 4
(2,426 Views)

Thanks for the reply,

I've addressed 1 and 2, and I think I've got it working the way I want it to, but I won't know till I get in the lab in the AM and test it.  As far as 3 and 4 are concerned, could you elaborate?  I pretty much copied an example VI, I thought I'd have to close the task for each iteration of each loop?  Indeed both channels are on the same device (USB-6002).  Not sure how I'd go about unifying both channels into one task, as I need one to hold a particular voltage until the other has finished scanning its range.

0 Kudos
Message 3 of 4
(2,414 Views)

The task would look like dev1/ao0:1  That gives analog output channels 0 and 1 for Device 1.

 

You don't need to stop and restart the task each iteration.  Let's say 1st iteration you send an array that consists of -10 and -10 as the two elements.  Next iteration you'd send -10,-9.9.  That first channel would stay the same, the second channel would get a new value.  At the last iteration of the inner loop, you'd have -10,+10.  Next outer loop iteration, you'd be going -9.9,-10.  then -9.9,-9.9.  Then -9.9,-9.8.  Writing the same value to a channel as it already is, is allowed and won't change the voltage.

0 Kudos
Message 4 of 4
(2,408 Views)