From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
02-13-2014 05:32 AM
Hi, I'm a new one.
I have a problem to sort 2d array with equal elements (it has 5000000 of elements from 1-255) for example:
1 2 1 1 3 4 5 5 6 1 2 3 (value from 1-255)
2 2 1 1 3 3 3 3 4 4 4 1 (value from 1-255)
And I need make array or matrix 255 rows vs 255 colomns, and count how many equal elements for example:
1 2 3 4 5 6
1 0 1 0 1 0 0
2 0 1 0 1 0 0
3 1 0 1 0 0 0
4 0 0 1 0 0 0
5 0 0 2 0 0 0
6 0 0 0 1 0 0
I'll be happy if someone could help me
02-13-2014 06:26 AM
Not sure I understand your problem / requirement, can you explain it a bit better please? Also post any code you have already tried.
02-13-2014 06:29 AM
Hi Bloodhorror,
when you want to sort a 2D array you should note by which order you want to sort: by column or by row? Which column (or row) will determine the sorting order?
How do you want to "make the 255×255 array"? By random numbers? Use two FOR loops…
Do you want to count equal numbers for each row, each cloumn or the whole array?
Usually this is called "histogram" and LabVIEW offers ready-to-use functions for that purpose!
02-13-2014 07:00 AM
I understand that it's very complicated explain.
I build 2d array from two 1darray each of them has values 1-255. So right now i must constract array or matrix 255x255 where must calculat how many times value from (1-255) for one array in another array and write this sum for each value 1-255. I try to show it
1 2 so I need array 3x3; for first row for value 1 I have two times value 3 and one time value 2
2 2 2 I have two times value 1 and one time value 2 and one time value 3
3 2 3 I have two times value 2 and one time value 3
3 2 so my result matrix will be 1 2 3
3 3 1 0 1 2
2 3 2 2 1 1
2 1 3 0 2 3
2 1
1 3
1 3
Maybe its more clear
02-13-2014 07:08 AM
Hi bloodhorror,
- build an 1D array of cluster from your two 1D arrays.
- Sort that cluster array.
- split that array two pick the parts with equal first cluster element
- from the parts you build an array of the 2nd cluster element and calculate an histogram of
- repeat 3rd and 4th step for each 1st cluster element
02-13-2014 07:35 AM
02-13-2014 08:36 AM
Thanks for your help but maybe I do something wrong because Vi not working
02-13-2014 08:38 AM - edited 02-13-2014 08:46 AM
You have not wired the array in to the place element structure. Its just wired through.
02-13-2014 10:01 AM
Many Many thanks
02-14-2014 12:41 AM
can you provide the final VI with no errors .....