LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

deleting array elements

Hi!
 
I have a problem with my program. i have an array and in this array a several numbers. With the "In Range and Coerce" function i want to prove if the the array element is inside or outside of my limitations. If my array element is in the outside of my limitation, the code in the case structure should delete this element.
 
I need this program, because the array is displayed on a graph and i want only display the date, which is in the limitations.
 
I hope somebody could help me!
 
Best regards,
 
Peter
Labview 7.1 on Windows 2000
0 Kudos
Message 1 of 8
(3,189 Views)
sorry i have forgotten to tell, what the problem is. the problem is, that the program don*t delete the array elements, which are in the outside of the limits!
 
peter
Labview 7.1 on Windows 2000
0 Kudos
Message 2 of 8
(3,180 Views)

Your problem is that the wire always holds the original array you wired into the loop, so only what happens in the last iteration actually matters. You should change the tunnel into a shift register, which will cause the new array to be carried into the next iteration. The problem is also that now i isn't the right number, because once you erase an element, all the following elements have their index decrease by 1, so you need another shift register to know which element you should actually delete now.

Another option you have is using Insert Into Array to build a new array, instead of deleting elements from the old one. This will also require a shift register to hold the array.


___________________
Try to take over the world!
Message 3 of 8
(3,166 Views)
Hallo Peter
 
Das Problem tritt auf, weil du immer wieder das selbe Array liest.
 
Die Knoten am Loop sollten Shift-Register sein, damit das Array, bei dem das Element gelöscht wurde, bei der nächsten Iteration gelesen wird. Allerdings musst du dann auf einen While-Loop umstellen, da du ansonsten Elemente lesen willst, die es im Array nicht mehr gibt.
 
Anbei eine mögliche Lösung.
 
Hoffe es hilft weiter.
 
Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 4 of 8
(3,165 Views)

Hi,

You need to replace the tunnels where the array enters in the loop with shift registers.

Your problem is because you are deleteing the elements allways from the initial array and then you are not assigning that new array to the original one.

So in each iteration you have allways the original array.

Right click the tunnels and choose "replace with shift register" and then choose the right one too. This way in the next iteration you'll have the atltered array from the previous one.

Hope this helps,

Paulo

Message 5 of 8
(3,164 Views)

Hi guys! Thank you for your fast answers!

THANKS!

Best regards,

Peter

 

Dankeschön an becktho, du hast mir wirklich  weitergeholfen!

Labview 7.1 on Windows 2000
0 Kudos
Message 6 of 8
(3,158 Views)

Hi,

Glad that it's solved...

But please next time don't post bmp's.

Use a compressed format.

Paulo

0 Kudos
Message 7 of 8
(3,153 Views)

Noch ein kleiner Hinweis, da du offenbar neu in der LV-Forum-Familie bist - versuche doch in Zukunft grosse Anhänge zu vermeiden (mehrere Dateien gezippt, Bilder als .png oder .jpg, usw.)

 

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 8 of 8
(3,148 Views)