test over 3rd dimension MATLAB
I have a 3d array. 1st dim is xcoordinate of pixel
2开发者_运维百科nd dimension is y - coordinate of pixel. 3rd coordinate is time (or could be though of as the frame number).
I want to do a test to see if any pixel is equal to zero for every single frame (along 3rd dimension).
How would I write this test?
I need returned the pixels which are ALWAYS true!!!
Rather than all
you could use any
. If I understand you correctly, the code would go something like this for a single "pixel"
any(A(x,y,:))
where A
is the 3d matrix. If the result is 1
, then the given pixel does have a non-zero value for at least one frame, and 0
otherwise.
精彩评论