I'm trying to count unique numbers in an array that is already sorted with bubble-sort method.
I want to store the result in a 2D-array in LabVIEW.
I have tried many things, but for some reason it doesn't work.
This is my code:
// COUNT NUMBERS
int colorCount[256][2];
int m, n;
int getal;
int first = 1;
int prevG, prevP;
int tel = 0;
for (m = 0 ; m<12; m++){
getal = Dnum[m];
if( first == 1){
colorCount[0][0] = getal;
colorCount[0][1] = 1;
first = 0;
prevP = 0;
}
else{
if( prevG == getal){
tel = colorCount[prevP][1];
colorCount[prevP][1] = tel++;
}
else{
prevP++;
colorCount[prevP][0] = getal;
colorCount[0][1] = 1;
}
}
prevG = getal;
}