LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Bug in "Delete From Array"

Hi,

I Was trying to delete all elements from an array using "Delete From Array" by connecting rows & length. Since I have deleted all elements from array, the output "Array w/ Subset deleted" should be empty and its expected  array size is "0*0". But here output array is empty, and its array size is retaining as source array size. What will be the reason for this. Is it a bug?

Here am attaching the image also.

 

Alwin_Capsys_0-1692699182022.png

 

0 Kudos
Message 1 of 11
(1,255 Views)

 


@Alwin_Capsys  ha scritto:

the output "Array w/ Subset deleted" should be empty


This output IS empty (as per your image), so what's the problem?

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 11
(1,249 Views)

For a multi-dimentional array, its size is the product of all of the dimension sizes.  So the number of elements in your "deleted array" is 0 x 3 = 0.  

 

An interesting "experiment" to try is to delete by columns instead of by rows.  My guess (I'll let you find out if I'm right) is you'd end up with an array of 2 rows and 0 columns, whose size is also 2 x 0 = 0.  I also predict this will generalize to arrays of any dimension (you already know it's true for dimension 1 ...)

 

Bob Schor

Message 3 of 11
(1,241 Views)

Then output array size should be "0*0".

But I am getting array size as "0*3". Why it is because?

0 Kudos
Message 4 of 11
(1,240 Views)

I think, whatever you have mentioned is right. But it doesn't meet my requirement. 

0 Kudos
Message 5 of 11
(1,229 Views)

Hi Alwin,

 


@Alwin_Capsys wrote:

whatever you have mentioned is right. But it doesn't meet my requirement. 


So the problem is your requirement/expectation…

 

What exactly is your requirement? The ArraySize function already tells you the array contains "0" elements…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 11
(1,210 Views)

Sorry for missing the details.

 

Since I am using this in a shift register, whenever  data comes in the next iteration (if it is lesser array size - expected array size is the array size of incoming data), it automatically creates array size matching with this size. So extra columns getting added.

Below am attaching the recreation of this bug as a VI. Please explain me, why 0's getting added as column in the output array even my source array size is always "10*5".

 

 

0 Kudos
Message 7 of 11
(1,189 Views)

Hi Alwin,

 

please downconvert to LV2019 to receive more/faster help. Many of us don't use the very latest LabVIEW versions…

Best regards,
GerdW


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

Det problem does not seems to be with the delete from array, but a "Insert into Array" in combination with your delete. 

 

Insert into Array bug.png

If you remove/disable the Insert into Array, then it will function as you expect. 

 

0 Kudos
Message 9 of 11
(1,151 Views)

@Alwin_Capsys wrote:

Then output array size should be "0*0".

But I am getting array size as "0*3". Why it is because?


The Delete From Array only subtracts the size from one index.  In your case, it is subtracting 10 from the row index size, leaving it as 0, but the column size is not affected.  Then when you come back around, the Build Array adds to both sizes.  The Insert Into Array only adds to the column size, leaving the row size alone.

 

I know this has been hammered out many times on this board.  I just don't have the time to dig at the moment.


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 10 of 11
(1,148 Views)