Can anyone explain to me what is going on in this line of MatLAB code
问题 y = rand(20,3); aa= unidrnd(2,20,3) - 1; val = ( aa & y<1.366e-04) | (~aa & y<8.298e-04); aa(val) = ~aa(val); I have this code. Can any one explain to me what is happening here. I have tried to understand it step by step (debugging) but I cannot understand the purpose of using inverse '~' in line 4 and also using 'val' as indices. 回答1: y = rand(20,3); Creates a matrix of uniformly distributed random numbers, y . aa= unidrnd(2,20,3) - 1; Creates a matrix of uniformly distributed random