The code does not see else condition

7 views (last 30 days)
In the code last if statement does not works. In order to title the plot.

Accepted Answer

Scott MacKenzie
Scott MacKenzie on 24 Jun 2021
Edited: Scott MacKenzie on 24 Jun 2021
You've got an error in how you setup the if-expressions. For example, you need to change the first if-expression from
320 < wavelength < 325
to
320 < wavelength && wavelength < 325
Change the others in a similar manner, and try again.
To explain, note that
320 < wavelength < 325
is syntactically correct, but is the same as
(320 < wavelength) < 325
and reduces to either
0 < 325
or
1 < 325
I doubt this is what you intended.
  1 Comment
Onur Hakverdi
Onur Hakverdi on 24 Jun 2021
320 < wavelength && wavelength < 325 I tried this but It gives error.

Sign in to comment.

More Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!