Reputation: 1802
I have an array of 20 elements and I am trying to round off all the elements in the array to its nearest integer.
For example, 1.3 should be rounded off to 1 and 1.6 should be rounded off to 2.
Thanks in Advance
Upvotes: 0
Views: 58
Reputation: 19689
array = 20*rand(20,1) %random values for an array of 20 elements
round(array)
Upvotes: 1