if statement matlab problem

2 次查看(过去 30 天)
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.

采纳的回答

Rafael S.T. Vieira
编辑: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.

请先登录,再进行评论。

更多回答(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