The submission in your first link might be an alternative depending on what you want, it's a little different from my submission. The second link does not check the input and you might as well use mod(x, 2) in my opinion.

It can be more complicated if you want errors to be raised on input where it is not possible to determine if a number is odd or even isodd(1e30) for example.

I found a bug:
>> x=int8(-128)
x =
-128
>> isodd(x)
ans =
1
because abs() will round the result to fit in int8, so abs(x)=127. Same for all "weird numbers" in two complement form intN(-2^(N-1)).

The submission in your first link might be an alternative depending on what you want, it's a little different from my submission. The second link does not check the input and you might as well use mod(x, 2) in my opinion.

It can be more complicated if you want errors to be raised on input where it is not possible to determine if a number is odd or even isodd(1e30) for example.

I notice that there are a couple of other FEX files called "isodd".
http://www.mathworks.com/matlabcentral/fileexchange/24278
http://www.mathworks.com/matlabcentral/fileexchange/2006

Do you know of any differences between these files and yours?
Darren

Hi Darren,
The submission in your first link might be an alternative depending on what you want, it's a little different from my submission. The second link does not check the input and you might as well use mod(x, 2) in my opinion.

Hi Oleg,
It can be more complicated if you want errors to be raised on input where it is not possible to determine if a number is odd or even isodd(1e30) for example.

Hi Ulf,
I notice that there are a couple of other FEX files called "isodd".
http://www.mathworks.com/matlabcentral/fileexchange/24278
http://www.mathworks.com/matlabcentral/fileexchange/2006
Do you know of any differences between these files and yours?
Darren

Comment only