LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Replace Array Subset to populate 2D array

I am attempting to use "Replace Array Subset" to populate a 2D array. However, when I replace one row, the previously replaced row is cleared. I can't figure out what I'm doing wrong. I created the attached vi to illustrate the problem. I tried "Insert Into Array" with the same result.
 
John
0 Kudos
Message 1 of 6
(3,224 Views)
Hi John
 
Could you attach your vi as LV7.0? There are still lots of users which do not use LV7.1.
 
If you don't know how to do that:
1. File-Menu
2. Save with options...
3. Select Save for previous version in the new window
 
Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 2 of 6
(3,218 Views)

You need to use a shift register, check the online help for details. See attached modification (LabVIEW 7.1)

 

(Also make sure you place a delay in your loop, it is not necessary to repeat the same operation millions of times a second. Use an event structure so the loop only spins if needed.)

0 Kudos
Message 3 of 6
(3,218 Views)
Ah - the mighty wizard did the job...Smiley Very Happy
So there's no need to attach it as LV7.0.
I assumed it would be a missing shift-register - but without looking at the code...
 
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 4 of 6
(3,214 Views)

Thanks for the feedback guys. Altenbach, your solution certainly does what I'm trying to do. Thanks for taking the time to show me. I know what a shift register does and how it's used, but I don't understand why I need it in this case. Doesn't the array retain a value once set? if I'm not resetting a particular element of the array I would expect it to retain its old value. Can you offer any insight into what's going on here?

Thanks again

John

0 Kudos
Message 5 of 6
(3,201 Views)


@ciramjo wrote:

Doesn't the array retain a value once set? if I'm not resetting a particular element of the array I would expect it to retain its old value. Can you offer any insight into what's going on here?


Follow the money wire!
 
At every loop iteration, you take the ORIGINAL array (all zeroes!) from the input tunnel, replace the desired row (only one!), and write the entire table. All data will be fresh. There is no place where old data is retained. Try some execution highlighting for illustration. 🙂
0 Kudos
Message 6 of 6
(3,195 Views)