a = [1 2 5 9]; b = idx2mask(a); a = [1 2 5 9]; b = idx2mask(a, 10); rng(1); a=rand(99,1)>0.5; b=find(a); c=idx2mask(b,99); assert(isequal(a,c));
Mehul Gajwani, Monash University, 2024