MATLAB: Natural number determination

natural number

In a vector how a determinate if the values is a natural number or not A=[ 1 2.2 3 5 6 8.8 9.6 ]

Best Answer

A == round(A)
That will give a 1 for integers. You can add a test for positiveness if you want it.