Filter löschen
Filter löschen

sorting is not sorting?!

5 Ansichten (letzte 30 Tage)
azaandria
azaandria am 16 Feb. 2021
Kommentiert: azaandria am 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);

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu Shifting and Sorting Matrices finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by