There is a X,Y,Z rectangular matrix M partly filled by the non-zero numerical data. There is a direction of view, along X, or, Y, Z direction.
It is simple to calculate projection of the matrix on view direction, Z in following case, as a mean(M(:,:,1)), median(M(:,:,1)), max(M(:,:,1)), etc.
Is there a simple method how to find such projection, when each corresponding projection's value equal to the first non-zero element along direction of projection? It is similar to the case, when each non-zero M element is "non-transparent", shadowing all other elements behind it.
Of course, it is possible to organize 2D loops to calculate such element, but it will be very time consuming operation.
Thanks for proposals and help