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

 Accepted Answer

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 Comment

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.

Sign in to comment.

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Asked:

on 29 Jun 2021

Commented:

on 30 Jun 2021

Community Treasure Hunt

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

Start Hunting!