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

6 Ansichten (letzte 30 Tage)
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.

Akzeptierte Antwort

the cyclist
the cyclist am 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.

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by