→ celestialgod: de2bi(1:(2^k-1))*2-1 其中k是+1跟-1的個數總和 04/28 14:55
→ celestialgod: 我錯了,不要理我QQ... 04/28 14:56
→ celestialgod: nchoosek(1:16, 7)把全1的矩陣換掉對應位置變成-1 04/28 15:02
推 celestialgod: m = nchoosek(1:16, 7);res = ones(size(m, 1), 16) 04/28 15:07
→ celestialgod: for i = 1:size(m, 1), res(i, m(i,:)) = -1; end 04/28 15:07
→ celestialgod: 應該有更好的方法QQ 04/28 15:07
→ celestialgod: perms([ones(1,7), -ones(1, 9)])不過他不給我跑XD 04/28 15:12
→ Feltonee: 謝謝C大 那請問如果我想要隨機取 畢竟這樣會一次RUN 04/28 15:13
→ Feltonee: 全部,資料量過大 04/28 15:13
→ celestialgod: 對不起,我沒看到隨機取... 04/28 15:15
→ celestialgod: 那就直接 randsample(1:16, 7) 04/28 15:16
→ Feltonee: 還是很感謝你^_^,你已經幫我很大的忙了XDD 04/28 15:17
→ celestialgod: randsample 可以用randperm(1:16)取前7個 04/28 15:17
→ celestialgod: randsample比較舊的版本沒有 04/28 15:18
→ celestialgod: 隨機取沒有重複,感覺不太可能= = 04/28 15:19
→ celestialgod: 除非記錄你已經取出來的,再做比對 04/28 15:19
→ celestialgod: 但是到最後記憶體還是會爆掉 04/28 15:19
→ celestialgod: 可以考慮用MEX...取道一定數目停止再從斷點取 04/28 15:22
→ celestialgod: 利用c++的next_combination 04/28 15:22
→ celestialgod: 我之前就這樣分開去算...我要的GLOBAL MAX... 04/28 15:23
→ Feltonee: OK 謝謝你 這兩個方法我都會試一試 ^__^ 04/28 15:32