locate element using find function in 3D matrix
古いコメントを表示
hello,
I am working in the code bellow. The main purpose of question is to determine the location of varibale B(:,:,i). respecting the 3 indeex of the matrix.
%------ the declation of matrix and choose the 9 largest value of the matrix
t = input('Enter indeex 3 of your matrix - ')
matrix2 = rand(6,6,t)
for i = 1:t
T2(:,:,i) = unique(matrix2(:,:,i)) % Determine the unique of variable matrix. tunique size 6*6*1 , 6*6*2 and 6*6*3.......6*6*t
B(:,:,i) = T2(27:36,:,i) % I choose only the last 9 nums from t unique
end
% I need to know the position of each B(:,:,i) in the main matrix2 and
% their indeex
for d = 1 : t
for j = 1:9
[a(j) b(j)] = find(matrix2(:,:,d) == B(j,:,d)); % I used the function find to locate the varivale o in the matrix
end
end
I really appreciate any help
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!