Clear Filters
Clear Filters

sorting is not sorting?!

5 views (last 30 days)
azaandria
azaandria on 16 Feb 2021
Commented: azaandria on 16 Feb 2021
Using command sortrows(x,n) and it is not working? Any help would be appreciated please! Trying to sort column 3 in ascending order. My sort command is 2nd line to the last.
Thank you!
disp(' Test Scores by Student ID#');
disp(' ');
disp(' ID# T1 T2 T3');
disp(exam_scores);
student_5=exam_scores(5,:);
test_1=exam_scores(:,2);
test_2=exam_scores(:,3);
test_3=exam_scores(:,4);
test_scores=[test_1,test_2,test_3];
disp(' ');
disp('Student 5');
disp(student_5);
disp(' ');
disp('Test #1');
disp(test_1);
disp(' ');
disp('Standard Deviation for each test:');
std=std(test_scores);
disp(std);
disp(' ');
disp('Variance for each test:');
variance=(var(test_scores));
disp(variance);
disp(' ');
sum=sum(test_scores,2);
round_sum=round(sum);
possible_points=300;
students_score=(round_sum./possible_points);
percentage=(students_score.*100);
student_id=exam_scores(:,1);
table=[student_id,sum,percentage];
y=round(table);
disp(' ID# Pts %');
sortrows(y,3);
disp(y);

Accepted Answer

dpb
dpb on 16 Feb 2021
sortrows(y,3);
is a no-op because you didn't save the result.
y=sortrows(y,3);

More Answers (0)

Categories

Find more on Shifting and Sorting Matrices in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!