Question: Write a function called RoundZero() that iterates through each value in a matrix and rounds positive numbers to the nearest integer, and sets negative numbers
Write a function called "RoundZero()" that iterates through each value in a matrix and rounds positive numbers to the nearest integer, and sets negative numbers equal to zero.
Your function takes a single input variable:
- M - a matrix of floating point double numbers.
Your function has three outputs:
- Mout - the matrix with rounded and zeroed values
- nr - the number of positive elements rounded.
- n0 - the number of negative elements set to zero, or originally zero.
Step by Step Solution
3.31 Rating (148 Votes )
There are 3 Steps involved in it
Heres an implementation of the RoundZero function in Python import numpy as ... View full answer
Get step-by-step solutions from verified subject matter experts
