Use info in the row based on it being the max value
1 view (last 30 days)
Show older comments
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);
0 Comments
Answers (1)
Stephen23
on 1 Feb 2024
The second output from MAX is the index, you can use that:
[maxDiameter,idx] = max(diameter);
row = mat(idx,:)
0 Comments
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!