Use info in the row based on it being the max value

1 view (last 30 days)
I have an excel sheet with info that i turned into a matrix, there is info on year, distance, diameter, energy etc.
I did determine the biggest object in diameter using max(), now based on the location of that cell in need to use the info in that ROW without hardcoding. How do I chain index the row based on the max value in the column from previous condition? See code below..
neos = readmatrix('neosData.xlsx');
mat = neos
diameter = mat(:,7);
maxDiameter = max(diameter);

Answers (1)

Stephen23
Stephen23 on 1 Feb 2024
The second output from MAX is the index, you can use that:
[maxDiameter,idx] = max(diameter);
row = mat(idx,:)

Products

Community Treasure Hunt

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

Start Hunting!