我试图找到一个 2d 数组,它表示 3d 数组中第 3 维的最小值。例如
a = floor(rand(10,10,3).*100); % representative structure
b = min(a,[],3); % this finds the minimum but also includes 0
我尝试使用:
min(a(a>0),3)
但这不正确?我想我可以对 a 的第三维进行排序,然后在 1:depth-1 内找到最小值 - 但这似乎不是最有效的方法?
有什么想法吗?