Hi
I would like to generate
N = 4
a{1} = 1111111100000000 a{2} = 1111000011110000 a{3} = 1100110011001100 a{4} = 1010101010101010
N = 5
a{1} = 11111111111111110000000000000000 a{2} = 11111111000000001111111100000000 a{3} = 11110000111100001111000011110000 a{4} = 11001100110011001100110011001100 a{5} = 10101010101010101010101010101010
this kind of arrays. And I would like to get sum(b(a{i}==1)) for all i as well.
In fact, the goal is only to get the array a{idx} where [~,idx] = min(cp) with cp = sum(b(a{i}==1))
Anyone has a faster solution rather than double for-loop?
Thanks,
Best Answer