vectorization - Avoiding for-loops in this Matlab matrix operation -


i have large 4 dimensional matrix, , wish 1) find minimum of 2 of dimensions (i.e. 4000x4000 result) , 2) count number of elements in last 2 dimensions less (lets say) 5 times minimum (i.e giving result of 4000x4000). i'm bit stumped how without reverting loops

some code might aid description:

a      = rand([4000,4000,7,7]); b(:,:) = min(a(:,:,1:7;1:7)); % isn't quite right? c      = size( < 5*b ) % totally wrong 

any pointers great - many thanks!

if understood correctly, following should job:

mn = min(min(a,[],3),[],4); num = sum(sum(bsxfun(@lt, a, 5*mn),3),4) 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -