Get the max value and indices of a fourth order tensor.

6 vues (au cours des 30 derniers jours)
Umberto Bettinardi
Umberto Bettinardi le 16 Mai 2018
Modifié(e) : James Tursa le 16 Mai 2018
Hello, i created a function that gives the efficiency of a machine given 4 imputs. Each imput belongs to a vector so in the end i get a 4th order tensor. I'd like to write a function that finds the maximum value in the tensor and also returns it position (i.e indices). Any help would be appreciated.

Réponse acceptée

the cyclist
the cyclist le 16 Mai 2018
If T is the array, then
[M,idx] = max(T(:))
will give the maximum value and linear index to that value.
You can then use ind2sub to get from the linear index to the subscript indices.

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Tags

Produits


Version

R2017a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by