I have a large 4 dimensional matrix, and I wish to 1) find the minimum of 2 of those dimensions (i.e. a 4000×4000 result) and then 2) count the number of elements in those last two dimensions that are less than (lets say) 5 times the minimum (i.e giving a result of 4000×4000). I’m a bit stumped as to how to do this without reverting to for loops
Some code might aid my description:
A = rand([4000,4000,7,7]);
B(:,:) = min(A(:,:,1:7;1:7)); % this isn't quite right?
C = size( A < 5*B ) % obviously totally wrong
any pointers would be great – many thanks!
If I understood this correctly, the following should do the job: