[英]test over 3rd dimension MATLAB
I have a 3d array. 我有一个3D阵列。 1st dim is xcoordinate of pixel
第一个暗点是像素的x坐标
2nd dimension is y - coordinate of pixel. 第二维是y-像素坐标。 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
. 而不是
all
您可以使用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. 其中
A
是3d矩阵。 If the result is 1
, then the given pixel does have a non-zero value for at least one frame, and 0
otherwise. 如果结果为
1
,则给定像素的至少一帧确实具有非零值,否则为0
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.