[Scilab-users] mean of elements corresponding element is "true"

Rafael Guerra jrafaelbguerra at hotmail.com
Sat Mar 3 13:15:30 CET 2018


An alternative solution:
n=10;
M= bool2s(rand(n,n)>0.5);  // Boolean to zero-ones matrix
A= rand(n,n);
x=  sum(A.*M,'r') ./ sum(M,'r');


Regards,
Rafael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20180303/c1ae4710/attachment.htm>


More information about the users mailing list