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

 Akzeptierte Antwort

Jan
Jan am 29 Jun. 2021

1 Stimme

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 Kommentar

Rajib Panja
Rajib Panja am 30 Jun. 2021
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 29 Jun. 2021

Kommentiert:

am 30 Jun. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by