| ²é¿´: 484 | »Ø¸´: 2 | ||
wxyuan2014ͳæ (СÓÐÃûÆø)
|
[ÇóÖú]
ÇóһάÊý×é×îСֵË÷Òý ÒÑÓÐ2È˲ÎÓë
|
| ´ó¼ÒºÃ£¬ÇëÎÊJavaÖÐÓÐûÓÐÇóÊý×é×îСֵË÷ÒýµÄº¯ÊýÄØ£¬ÀàËÆµÄÔÚMATLABÖÐÓÐw=find(n==min(n(0:99))) |
» ²ÂÄãϲ»¶
Ò»Ö¾Ô¸2110£¬»¯Ñ§Ñ§Ë¶310·Ö£¬±¾¿ÆÖصãË«·ÇÇóµ÷¼Á
ÒѾÓÐ11È˻ظ´
Ò»Ö¾Ô¸»ª¶«Àí¹¤085601²ÄÁϹ¤³Ì303·ÖÇóµ÷¼Á
ÒѾÓÐ12È˻ظ´
»¯Ñ§0703-Ò»Ö¾Ô¸211-338·ÖÇóµ÷¼Á
ÒѾÓÐ10È˻ظ´
307·Ö²ÄÁÏרҵÇóµ÷¼Á
ÒѾÓÐ11È˻ظ´
315Çóµ÷¼Á
ÒѾÓÐ17È˻ظ´
0703»¯Ñ§
ÒѾÓÐ27È˻ظ´
µ÷¼Á
ÒѾÓÐ6È˻ظ´
280Çóµ÷¼Á
ÒѾÓÐ9È˻ظ´
324Çóµ÷¼Á
ÒѾÓÐ13È˻ظ´
»¯Ñ§µ÷¼ÁÇóÖú
ÒѾÓÐ13È˻ظ´

FMStation
ÖÁ×ðľ³æ (ÖªÃû×÷¼Ò)
- Ó¦Öú: 591 (²©Ê¿)
- ¹ó±ö: 0.03
- ½ð±Ò: 18651.2
- ºì»¨: 97
- Ìû×Ó: 8891
- ÔÚÏß: 1491.2Сʱ
- ³æºÅ: 2400059
- ×¢²á: 2013-04-04
- רҵ: ¼ÆËã»úÓ¦Óü¼Êõ
¡¾´ð°¸¡¿Ó¦Öú»ØÌû
¡ï ¡ï ¡ï ¡ï ¡ï
¸Ðл²ÎÓ룬ӦÖúÖ¸Êý +1
wxyuan2014: ½ð±Ò+5 2016-08-08 15:43:13
¸Ðл²ÎÓ룬ӦÖúÖ¸Êý +1
wxyuan2014: ½ð±Ò+5 2016-08-08 15:43:13
|
C Code: #include<stdio.h> int main(void) { int i, j, size_A=2, size_A2=3; float A[2][3]= {{-1e300, 2, 3},{2,-1e300,5}}; /*NOTE: -1e300 outputs as -Inf*/ int size_index=0; int rloc, cloc; float index[size_A*size_A2]; for(j=0; j<size_A2; j++) /*Finds rows where values in each column are greater than -Inf. Also finds length of new linear matrix*/ { for(i=0; i<size_A; i++) { if(A[j]>-1e300) { cloc=j+1; rloc=i+1; size_index++; index[1][size_index]= rloc; printf("col:%d\nrow:%d\nsize:%d\n", cloc, rloc, size_index); }printf("%d", index[1][size_index]); } } return 0; } http://cboard.cprogramming.com/c ... -find-function.html |
2Â¥2016-08-08 14:16:42
jianliu67
ľ³æ (СÓÐÃûÆø)
- Ó¦Öú: 27 (СѧÉú)
- ½ð±Ò: 4053.5
- ºì»¨: 4
- Ìû×Ó: 216
- ÔÚÏß: 135.7Сʱ
- ³æºÅ: 3511817
- ×¢²á: 2014-11-01
- ÐÔ±ð: GG
- רҵ: ¼ÆËã»ú¿ÆÑ§µÄ»ù´¡ÀíÂÛ
¡¾´ð°¸¡¿Ó¦Öú»ØÌû
¡ï ¡ï ¡ï ¡ï ¡ï
¸Ðл²ÎÓ룬ӦÖúÖ¸Êý +1
wxyuan2014: ½ð±Ò+5 2016-08-09 15:54:08
¸Ðл²ÎÓ룬ӦÖúÖ¸Êý +1
wxyuan2014: ½ð±Ò+5 2016-08-09 15:54:08
|
¿´Äã×·ÇóʲôÁË. 1. Èç¹û×·ÇóЧÂÊ, ÄãµÃ×Ô¼ºÐ´Ò»¶Îcode, Ñ»·Õû¸öÊý×é, µÃµ½×îСֵµÄͬʱ±£´æËüµÄindex. 2. Èç¹ûÖ»×·Çó´úÂë¼ò½àºÃ¿´, ¿ÉÒÔÕâÑùд: int minIndex = list.indexOf(Collections.min(list)), ÕâÀï <ArrayList>list ÊÇÄãµÄÊý×é. The second one is exactly like the Matlab method you wanted, but it goes through the same list twice in the worst case scenario. The first method only goes through the list once so it's faster. |
3Â¥2016-08-09 10:40:45














»Ø¸´´ËÂ¥