User input in the while loop:
Here is an illustration of running this script:
>> readonenum
Enter a positive number: -5
Invalid! Enter a positive number: -2.2
Invalid! Enter a positive number: c
??? Error using ==> input
Undefined function or variable 'c'.
Invalid! Enter a positive number: 44
Thanks, you entered a 44.0
Note that the MATLAB itself catches the character input and prints an error message and repeats the prompt whenever the c was entered.