Matlab 过滤高于一定阈值的3D矩阵?
我有两个同样大小的3D矩阵。例如,A包含从0到1的值,B包含某些离散值 我想从B矩阵中提取高于A中某些阈值的值 有人能帮我吗?像这样吗?看一看Matlab 过滤高于一定阈值的3D矩阵?,matlab,multidimensional-array,indexing,matrix-indexing,Matlab,Multidimensional Array,Indexing,Matrix Indexing,我有两个同样大小的3D矩阵。例如,A包含从0到1的值,B包含某些离散值 我想从B矩阵中提取高于A中某些阈值的值 有人能帮我吗?像这样吗?看一看 那么,你尝试过什么?你面临着什么问题? % Input. B = reshape(1:18, 2, 3, 3) A = rand(size(B)) % Threshold. thr = 0.75 % Output. output = B(A > thr) B = ans(:,:,1) = 1 3 5 2 4 6 a
那么,你尝试过什么?你面临着什么问题?
% Input.
B = reshape(1:18, 2, 3, 3)
A = rand(size(B))
% Threshold.
thr = 0.75
% Output.
output = B(A > thr)
B =
ans(:,:,1) =
1 3 5
2 4 6
ans(:,:,2) =
7 9 11
8 10 12
ans(:,:,3) =
13 15 17
14 16 18
A =
ans(:,:,1) =
0.80533 0.24370 0.89180
0.90358 0.22422 0.69243
ans(:,:,2) =
0.119366 0.168337 0.771999
0.206004 0.065481 0.979772
ans(:,:,3) =
0.0057303 0.1469925 0.0556628
0.0454038 0.4122576 0.9847027
thr = 0.75000
output =
1
2
5
11
12
18