if statement matlab problem

조회 수: 1 (최근 30일)
Maria
Maria 2020년 6월 5일
댓글: Rafael S.T. Vieira 2020년 6월 6일
I got issue on my code. That I put if statement under the else statement it's return a weird number.
The background here is in1 is for vector of original and resubimission grade. in2 is a character vector with entries reading either 'a' or 'm' , to determine if the two grade would be treat with average or maxium. But one requiurement is that when the resubimission grade is lower than the original grade, it would be picked original grade instead of average grade. Only when resubmission is higher and choose average. I added this argument under the else statement that
if(in1(ct>ct+1))
score=score+ct;
but the result comes out run. How should I fix it.
  댓글 수: 1
madhan ravi
madhan ravi 2020년 6월 5일
Paste code, screenshot is useless.

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

채택된 답변

Rafael S.T. Vieira
Rafael S.T. Vieira 2020년 6월 5일
편집: Rafael S.T. Vieira 2020년 6월 5일
Please, try to put end's at both if's. The inner if may be capturing the outer if end.
  댓글 수: 6
Maria
Maria 2020년 6월 5일
Hey thanks, it works!!! Appericate.
Rafael S.T. Vieira
Rafael S.T. Vieira 2020년 6월 6일
No problem. Glad to help.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by