Suppose the following matrix represents the number of saws ordered from your com
ID: 3812563 • Letter: S
Question
Suppose the following matrix represents the number of saws ordered from your company each month over the last year.
All the numbers should be zero or positive.
(a) Use an if statement to check whether any of the values in the matrix are invalid. (Evaluate the whole matrix at once in a single if state- ment.) Send the message “All valid” or else “Invalid number found” to the screen, depending on the results of your analysis.
(b) Change the saws matrix to include at least one negative number, and check your program to make sure that it works for both cases.
Explanation / Answer
if any(saws < 0) disp('Invalid number found') else disp('All valid') endRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.