LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Remove Array Elements

Ok, so I start out with two equal sized clusters of numbers that will eventually be plotted on an xy graph.  One cluster contains constant numbers for the x axis, the y axis data will be read from another file.  What I need to do is eliminate any zeroes that maybe in the cluster from the read file and delete the corresponding element in the constant cluster so I don't have zero points on my graph and the data stays aligned.  Thanks in advance.
 
Bobby
LabVIEW 2016 - Windows 7

CLAD
0 Kudos
Message 1 of 14
(5,239 Views)
Hi Bobby,

in the header you write "array elements", in the text you are talking about clusters... What exactly do you want to do? Any example code?
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 14
(5,237 Views)
Sorry, I'm changing the clusters to arrays before I send them to the xy graph.  I'm working on this piece of a larger program separately so I don't have much code to look at.  I've attached a picture of an example of what the two sets of data will look like.  The two sets will be joined together so for example in the picture the first element from each cluster will be plotted as (63,0) and the second as (125,45.7).  What I need to do is filter the (63,0) out while keeping the (125,45.7) together.  Every method I've tried so far shifts the values so I get the point (63,45.7) instead.
LabVIEW 2016 - Windows 7

CLAD
0 Kudos
Message 3 of 14
(5,230 Views)
No picture...

Without seeing the code, and without knowing how much data you're dealing with, this may not be the best solution... With that caveat known, you can try to use the OpenG Array functions instead of coding it up yourself. There's a Search Array function that will return all indices that match an input. Then, you can wire that output to their Delete Elements From Array VI. Note that the Search Array function uses the LabVIEW Search 1D Array function, which may be problematic with floats.
Message 4 of 14
(5,219 Views)
Sorry...too many things going on at once.....picture attached.
LabVIEW 2016 - Windows 7

CLAD
0 Kudos
Message 5 of 14
(5,214 Views)

One solution...

Michael

Message 6 of 14
(5,202 Views)
This is actually a fairly simple problem to solve. Why don't you post what you've done so far?

miguelc: You can simplify your example by using the Delete From Array instead of Replace Array Subset function inside the loop. Then you don't need the Reshape Array outside. Smiley Wink
0 Kudos
Message 7 of 14
(5,188 Views)

Here's an approach that uses the Delete From Array function to remove both the zero Y data, and their corresponding X values.  The "False" case simply increments the index being used to pull out the Y data.

Hope this helps,
-D



Message Edited by Darren on 04-30-2008 11:32 AM
Download All
Message 8 of 14
(5,185 Views)

smercurio_fc: Very true about using the Delete Array (like Darren just posted). For this small of dataset it wouldn't really matter; I've gotten into the habit though of doing like I posted because it doesn't require a new array buffer allocation like the Delete Array does.

Michael

Message 9 of 14
(5,177 Views)

Thanks for the replies guys!!  Darren, I had something like you posted in mind but I wasn't sure how to execute.  Shift registers are going to haunt me until I get a better understanding of how to use them.  I have a lot to study now, thanks to all again....

Bobby

LabVIEW 2016 - Windows 7

CLAD
0 Kudos
Message 10 of 14
(5,172 Views)