if statement matlab problem

1 Ansicht (letzte 30 Tage)
Maria
Maria am 5 Jun. 2020
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 Kommentar
madhan ravi
madhan ravi am 5 Jun. 2020
Paste code, screenshot is useless.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Rafael S.T. Vieira
Rafael S.T. Vieira am 5 Jun. 2020
Bearbeitet: Rafael S.T. Vieira am 5 Jun. 2020
Please, try to put end's at both if's. The inner if may be capturing the outer if end.
  6 Kommentare
Maria
Maria am 5 Jun. 2020
Hey thanks, it works!!! Appericate.
Rafael S.T. Vieira
Rafael S.T. Vieira am 6 Jun. 2020
No problem. Glad to help.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Downloads finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by