LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array of Clusters manipulation

Hello,

 

I have a 1D array of a cluster of 2 elements, 1d array of integers and 1d array of double (please see attached screen-shot) 

 

I need to get indexes 0, 2, 4, 6,8..and so on, and put them in index 1 of Array21.

 

So the resulting Array21_new will have indeces 0,2,4,6,8... at index 0; and indeces 1,3,5,7,9... at index 1.

 

This has to be inside a loop

 

 

Any clever .vi?

 

Thanks in advance

0 Kudos
Message 1 of 9
(3,946 Views)

Hi loba,

 

- use Decimate1DArray to get every second array element.

- use an autoindexing FOR loop to iterate over your "1D array of cluster"…

 

Any clever .vi?

We will not do your work for you! (Especially when it sounds like homework!)

Start by attaching your own attempt or solution. Ask for specific problems with your code.

We will comment your VIs or help you to solve (specific) problems.

That's the way a forum works!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 9
(3,937 Views)

Hi GerdW,

 

sorry if it sounded like I was trying to deliver my job to somebody else.

 

Please see the attached .vi and run it if possible.

 

My problem is that I dont understand how to use "Decimate 1d Array" block in a dynamic way, the block has no input for indexing.

 

NEW_cluster is the result Im looking for, in this example it goes up to 3, but it has to go up to N. How?

0 Kudos
Message 3 of 9
(3,917 Views)

loba wrote:

My problem is that I dont understand how to use "Decimate 1d Array" block in a dynamic way, the block has no input for indexing.


The Decimate 1D Array is resizable.  If you have it show 2 elements, it will seperate the array into 2 arrays.  The first array will be from elements 0, 2, 4, etc while the other array will have elements 1, 3, 5, etc.



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 4 of 9
(3,889 Views)

Yes the Decimate 1D Array is resizable, but only in edit-mode.

 

I need to feed an array with a non-fixed dymension, so it needs to resize depending on the dymension.

 

This block is perfect for what I need to do but it only account for fixed-size structures, there must be an other way...

0 Kudos
Message 5 of 9
(3,880 Views)

Hi loba,

 

the Decimate 1D Array is resizable, but only in edit-mode.

Yes, sure.

 

I need to feed an array with a non-fixed dymension, so it needs to resize depending on the dymension.

So what's the problem here?

DecimateArray takes any 1D array of "non-fixed length" and (when set to two outputs) gives you the "even" elements on the first output!

 

On your VI: Why do you decimate to three output arrays when you say you need every second array element?

Best regards,
GerdW


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

what a smart ass

0 Kudos
Message 7 of 9
(3,856 Views)

Things Not To Do

  • Don’t be rude. We all have bad days, let’s try to not take it out on others.

Source

 

You asked questions on how to do something.  Two very knowledgable people tell you how.  You state a function that was recommended wouldn't work.  A reply said it would when used properly.  No need to get upset.

0 Kudos
Message 8 of 9
(3,844 Views)

loba wrote:

I need to feed an array with a non-fixed dymension, so it needs to resize depending on the dymension.

 

This block is perfect for what I need to do but it only account for fixed-size structures, there must be an other way...


No it doesn't.  I works on any sized 1D array.  Perhaps you just need an example of how it works...



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 9 of 9
(3,830 Views)