필터 지우기
필터 지우기

sorting is not sorting?!

조회 수: 5 (최근 30일)
azaandria
azaandria 2021년 2월 16일
댓글: azaandria 2021년 2월 16일
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);

채택된 답변

dpb
dpb 2021년 2월 16일
sortrows(y,3);
is a no-op because you didn't save the result.
y=sortrows(y,3);
  댓글 수: 1
azaandria
azaandria 2021년 2월 16일
Thank you so much!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by