I am trying to remove the blank spaces from a 2D array. I break it down using 2 for loops but I am not getting any data back. The shift register should carry the data through?
Solved! Go to Solution.
Hi LearningLabVIEW,
The middle For Loop isn't actually doing anything because you're trying to index an empty 2D array constant (if you run with highlight execution on, you can see it). A quick fix is to instead replace your empty 2D string array with an array of zeros (or empty strings, or anything, actually) that's the same dimension as your Data Array.
And since you're using a Build Array function, it'll end up removing all the zeroes/blank spaces from Data Array, but it will also just append the result it to the end of your "source" array...you could just delete the first three columns afterwards (again, quick fix).
I'm sure someone else will chime in a better way to do it, that's just what I noticed in the two minutes that I could take a look!
It's not possible to remove a single element from a 2D array: you need to remove either an entire row (like in your case) or an entire column.
So, check if a row is completely blank: if so, remove it from the output. Hereafter an example. Right-click on the output tunnel to set is Conditional.
Edit: sorry! I re-saved the vi to LabVIEW 2017
Thank you for this. I was trying to iterate through each individual one. This works perfectly. Did not even think to do it this way.
Yes, you can only remove entire rows, of course.
Yes, there are many ways to do this. Here's my variation.