Why is this function not recognizing the correct number of rows?
Show older comments
In this function I am taking a matrix m where each row holds a student's grades and each column is a different assignment, and returning the lowest of the highest grade that each student achieved in any assignment. When I do minmaxgrade([74, 72, 78; 67, 89, 90; 89, 92, 100; 100, 80, 90]) I am getting a weird answer, ans = 67 72 78 instead of just 78.
Here's my code:
function M=minmaxgrade(m)
[R,~]=size(m);
M=min(max(m,[],R));
end
Accepted Answer
More Answers (0)
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!