Actual_Diagnosis_Matrix = [zeros(1,10),ones(1,10)];
number_correct= sum(Actual_Diagnosis_Matrix == Diagnosis_Matrix);
Final_percentage_correct=(number_correct/20)*100;
o/p:->
Matrix dimensions must agree.
Error in main (line 362)
number_correct= sum(Actual_Diagnosis_Matrix == Diagnosis_Matrix);
please help me with this problem as soon as possible

 채택된 답변

Jan
Jan 2021년 6월 29일

1 개 추천

The error message means, that Actual_Diagnosis_Matrix and Diagnosis_Matrix have different sizes. Then the == operator cannot compare them.
Check this using the debugger:
dbstop if error
Then run the code again. When Matlab stops at the error:
size(Actual_Diagnosis_Matrix)
size(Diagnosis_Matrix)

댓글 수: 1

Rajib Panja
Rajib Panja 2021년 6월 30일
thank you sir . Just for you , I point out my mistake and I fix it. There was a problem of matrix dimention. Actually Actual_Diagnosis_Matrix is a [1 20] matrix and Diagnosis_Matrix is [1 10] . that's why the error is happening . thank you so much sir. You are better than our college teachers.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

질문:

2021년 6월 29일

댓글:

2021년 6월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by