LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting elements from a 2D Array

Looking to do some data analysis on a dataset i'm capturing and got jammed up on the first step.  

 

I have a 2D array of (Z) height data where (X = rows) and (Y = Columns).  I actually get data for (1800) rows by (400) columns, the total array size is (7107 x 400), everything from row (1800) to (7107) is ZEROES.  I'd like to delete the ZEROES.  i tried delete from array and subset array VI's but i can't figure them out.  They don't do what i think they should do, i don't understand.  What i did learn is that delete means turn data into ZEROES, in other words the array size is not changed i can manipulate the data but really need to just change the size.

 

Anyway are there examples on how to do this?

0 Kudos
Message 1 of 8
(3,668 Views)

Hi coolhand,

 

what have you tried?

And why don't you use ArraySubset to get the first 1800 rows?

 

What i did learn is that delete means turn data into ZEROES, in other words the array size is not changed i can manipulate the data but really need to just change the size.

Which is completely wrong!

DeleteFromArray will remove rows or columns from a 2D array…

 

Anyway are there examples on how to do this?

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(3,665 Views)

As Gerd said, you are doing something completely wrong. However, we cannot tell unless you attach some simplified code that shows the problem you are seeing.

 

To do exactly what you want, you can use e.g.:

  1. delete from array
  2. array subset
  3. reshape array
  4. ...

("delete from array" is probably least preferred, because you have no use for the deleted portion, so why use a primitive that creates it. Not sure if the compiler eliminates that part of the code if the output is not connected)

 

0 Kudos
Message 3 of 8
(3,650 Views)

@altenbach wrote:

("delete from array" is probably least preferred, because you have no use for the deleted portion, so why use a primitive that creates it. Not sure if the compiler eliminates that part of the code if the output is not connected)


Yes, that portion is "stomped" now.  I can dig a little to find what version, but it was a while ago.


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
Message 4 of 8
(3,608 Views)

@crossrulz wrote:

@altenbach wrote:

("delete from array" is probably least preferred, because you have no use for the deleted portion, so why use a primitive that creates it. Not sure if the compiler eliminates that part of the code if the output is not connected)


Yes, that portion is "stomped" now.  I can dig a little to find what version, but it was a while ago.


Ok, found the thread over on LAVA: https://lavag.org/topic/16226-new-array-vi/?do=findComment&comment=109035

 

Delete From Array, as of LabVIEW 2014, is the most efficient way to get the last element of an array (don't wire the Index input).


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 5 of 8
(3,600 Views)

@crossrulz wrote:

@crossrulz

Delete From Array, as of LabVIEW 2014, is the most efficient way to get the last element of an array (don't wire the Index input).


Deleting the last element (or row, etc.) is not the same as deleting a random subset. It is not clear if one trivial optimization (only the array connected) lets us conclude that the other more general functionality (position and size connected) also optimizes for disconnected outputs. (A casual glance at your linked thread does not tell, but maybe I need to read more carefully... ;)) 

0 Kudos
Message 6 of 8
(3,587 Views)

The Array needed to be transposed, as soon as i transposed it the dimension changed as intended.  Not sure why i was getting all of the (0) fill in the data though that was weird.

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

Could it be that these were not actual zeroes, but just unused elements because the array container was resized larger than the array size? (Unused elements are typically shown as grayed zeroes, or whatever the default value for the element is.)

0 Kudos
Message 8 of 8
(3,576 Views)