multiple grouping octave and layers

조회 수: 2 (최근 30일)
Elder Winter
Elder Winter 2019년 4월 12일
편집: Elder Winter 2019년 4월 20일
Hey all, i want to ask how to grouping this data by octave (first column) and layer (second column), is there some way to do this? i thought it must be used groupcounts, i was tried, but still got an error. After grouping i must be sorted by the number. so i could know which minor of that group then proceed it first using kmeans(12) by at least 2 value every group. But if there is group that have less than 2, we skipped it.
1 1 159 92
1 1 111 43
1 1 111 64
1 1 119 56
1 1 131 113
1 2 192 121
1 2 192 104
1 2 203 63
2 2 147 84
2 2 150 73
2 2 166 31
2 2 167 70
2 2 171 70
2 2 181 32
2 2 183 80
2 2 185 85
3 1 200 18
3 1 134 63
3 2 110 31
groups would look like follows:
octave 3 and layer 2 = 1
octave 3 and layer 1 = 2
octave 1 and layer 2 = 3
octave 1 and layer 1 = 5
octave 2 and layer 2 = 8
result of kmeans must 12 point (i dont know how), so after using kmean at least like this below (number of group must be distributed)
octave 3 and layer 2 = 1
octave 3 and layer 1 = 2
octave 1 and layer 2 = 3
octave 1 and layer 1 = 3
octave 2 and layer 2 = 3
  댓글 수: 3
Image Analyst
Image Analyst 2019년 4월 19일
I didn't see where i was initialized. Anyway, we recommend against using i as an index or loop iterator/counter since it can also be used as the imaginary variable when using complex numbers. I have no idea what i and j even are so you should probably use a more descriptive variable name. Same comment for X, idx, and C -- use more descriptive names. It looks like C will get overwritten on each iteration and it doesn't look like you even do anything with it.
Elder Winter
Elder Winter 2019년 4월 19일
편집: Elder Winter 2019년 4월 20일
Ohh sorry, i was initialized 'i' in my code but didn't copy it in this code. I make 'i' as how many kpt i want in this case 'i = 12'. So 'i' minus by how many kpt in those octave and layer, as i said before each octave and layer at least have 2 kpt. If not, it will take from other octave and layer. At the end i get my kpt as much as i want. 'j' just giving hand to 'i', then but I can't find names that is suitable for the descriptive names. But i will try to find some.
I was try store it by using this code
storeKmeans{counter,1} = indexStack(cont,1);
storeKmeans{counter,2} = indexStack(cont,2);
storeKmeans{counter,3} = C(keypoint,1);
storeKmeans{counter,4} = C(keypoint,2);
It works, but could i make it to one line code?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Octave에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by