LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

array help!

I have one “pressure value” variable that services two instruments.  on each iteration of the while loop it flips between returning the pressure value for either A or b in a cyclic manner. Because of this id like to wire “pressure value”  into a 1D array to store them both, in essence,  demuxing them. where row 0 equals Instrument A and row 1 equals instrument B. every second cycle will update each element in the array, but only one element is ever updated every while loop cycle if you get me! This is controlled by the index whoch revert from 0,1,0,1,0,1,0 and so on. Im having  trouble implementing this probably easy thing! Can anyone offer up some assistance please? What I have is wrong I know.

0 Kudos
Message 1 of 6
(2,176 Views)

Why not put two requests within the while loop, one that services each device?

 

You could also use Reshap Array to take your 1-D array with intermixed elements and make a 2-D array where each device has its readings in its own column.

 

You could also use Decimate Array to break the alternate elements of the original 1-D array into two 1-D arrays.

 

I don't think you should be using Insert into Array.  Build Array is usually the correct function to use 99% of the time.

0 Kudos
Message 2 of 6
(2,170 Views)

i cant put two requests in to the loop as the upsatream 3rd party code retruns only one instrument at a time. How do i prevent the array growing, I only ever want two elemetns, but the shift register which i thought would be how i woul save the lat values is growing it by one each time!

0 Kudos
Message 3 of 6
(2,162 Views)

Then you don't want to use any build array or insert into array at all.

 

Just put both requests into the while loop.  First request goes to one indicator, second request goes to another.

0 Kudos
Message 4 of 6
(2,151 Views)

Im either not following you or vice versa. There is only one wire for my pressure i cant see how what your suggesting can work.

 

I think my below code now works for me. Thansk for your time

0 Kudos
Message 5 of 6
(2,141 Views)

What Ravens is saying is that you should treat the two instruments totally independantly.  You should have 2 controls to control the two instruments.  You should also have two different instrument calls, one for each instrument.  That is probably the best way to do this.

 

What you are asking for is a shift register that is initialized to an array of 2 elements.  You can then use Replace Array Subset to change the individual element you want to change.  Feed the resulting array back into the shift register.


GCentral
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 6 of 6
(2,124 Views)