sorting is not sorting?!

1 vue (au cours des 30 derniers jours)
azaandria
azaandria le 16 Fév 2021
Commenté : azaandria le 16 Fév 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);

Réponse acceptée

dpb
dpb le 16 Fév 2021
sortrows(y,3);
is a no-op because you didn't save the result.
y=sortrows(y,3);
  1 commentaire
azaandria
azaandria le 16 Fév 2021
Thank you so much!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Shifting and Sorting Matrices dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by