如何得到361x91数组中重复最大值的位置
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
最大值是两个重复的值,要得到两个的位置
0 commentaires
Réponse acceptée
Dyuman Joshi
le 8 Mai 2024
%Sample data
mat = magic(4);
mat = [mat; 1 4 9 16]
%Get the maximum value
val = max(mat, [], 'all')
%% Find the indices of all occurences of the max value
%Linear indices
idx = find(mat==val)
%Subscript indices
[r,c] = find(mat==val)
Note - Use tolerance to compare for floating point values.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Mathematics and Optimization dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!