LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the continuous values range from a 2D array?

Solved!
Go to solution

For a given 2D array with different values, i'm trying to get the range for which the values are continuous. However I'm just get the end values for the logic I have developed.For Example: if the input array isinput array.PNG

 

 

 

 

Then the output string array must be 

output array.PNG

0 Kudos
Message 1 of 12
(2,955 Views)

So your stuck.  You want your VI to behave a certain way, and it is not doing that.

 

Do you want us to just guess at what is going wrong?

 

If you want real help, then you should attach your VI so we can see what is wrong with it.

Message 2 of 12
(2,927 Views)

Hi guy,

 

and while you attach your VI you also should explain the "logic" behind your desired algorithm!

 

get the range for which the values are continuous.

- do you search for "continuously declining" numbers? Can there be "continuously rising" ranges? What about "continuously the same" ranges?

- do such "ranges" also span more than one row?

- are these integers, floats, or strings?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 12
(2,907 Views)
Hi Gerd , These values are continuously declining integers with a constant difference.I have attached the VI below which sorts the continuous values of each row into min-max ranges as described above. Since I am beginner, the code is clumsy and logic used might be tedious( Sorry for that 😞 ).Please let me know the mistakes and help me improve my knowledge. Thanks a lot!!!!
0 Kudos
Message 4 of 12
(2,890 Views)

Hi guy,

 

can you please attach a downconverted version of your VI? LV2017 would be nice!

(Edit menu -> save for previous…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 12
(2,887 Views)

Please resave your VI, but first put some values in the controls and save them as default.  Empty controls doesn't provide us any meaningful data to test you VI.

 

I do see a Rube Goldberg in there where you auto-index on an array, but proceed to use Index Array with the i terminal on a branch of that array to access the elements.  When you auto-index, it gives you each element one by one.  No need for the wire branch Index Array and i node.

0 Kudos
Message 6 of 12
(2,869 Views)

@curiousguy99 wrote:

For a given 2D array with different values, i'm trying to get the range for which the values are continuous. However I'm just get the end values for the logic I have developed.

 


Nothing in computing is "continuous". Your array values are quantized to the limitations of I32 and their position is quantized to integer index positions. It is not obvious how your 2D array of strings related to the input array at all. Please write a full paragraph explaining what algorithm you actually want.

 

(And yes, fill the control with typical default data before saving and attaching. We don't want to enter values into an empty array first.)

Message 7 of 12
(2,864 Views)
Solution
Accepted by topic author curiousguy99

So it seem you want to isolate ranges where the value decrements by one. Here's a very quick draft to get you started.

 

(For large inputs, I would only keep the max and min in the shift register, so modify if this is needed)

 

EDIT: slightly improved code can be found a few posts below.

 

 

GetRanges.png

Message 8 of 12
(2,853 Views)

Thanks a lot for your response!!

I noticed how over complicated my code was 😞 . This was a part of code where the each bit ( from 0-31 ) were assigned a bit definition name. I had to get get the position of the bits for the selected bit definition and populate the number of bits accordingly.The 2D array was the bit definition- occurrences array for which I had to calculate the position of the bits. Moreover something like this

Bit_position_from2d.PNG

0 Kudos
Message 9 of 12
(2,846 Views)

I need to get back and start working on the basics to build more efficient and simple code like you did here. Thanks a lot for putting your time and effort on this post 🙂 

0 Kudos
Message 10 of 12
(2,844 Views)