How do i produce a warning and an error for the user

조회 수: 2 (최근 30일)
Jose Grimaldo
Jose Grimaldo 2019년 9월 20일
답변: thoughtGarden 2019년 9월 20일
The task is to promt the user to enter an input between 0 and 200.I have to produce a warning and take the asbolute value. If the absolute value is greater than 200 I have to produce an error and terminate the program. This is what i have so far.

답변 (1개)

thoughtGarden
thoughtGarden 2019년 9월 20일
The task is to... sounds like homework!
I'll provide some food for thought
  • You currently only check for absolute values if the value is negative, but what would happen if a positive value was above 200? (hint: you should likely use an additional non-nested if statement to check the second condition)
  • Your use of warning and error are correct

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by