File Exchange

image thumbnail

ISWHOLE

version 1.0 (966 Bytes) by

True for integers(whole numbers).

0 Downloads

Updated

No License

ISWHOLE True for integers(whole numbers).

ISWHOLE(X) is 1 for the elements of X that are integers, 0 otherwise. ISWHOLE(X1,X2,..,XN) returns a 1-by-N array with 1 for integers and 0 otherwise.

ISWHOLE does not check for integer data type as does ISINTEGER.

Comments and Ratings (8)

srinivas.gs

works as expected. just make sure to delete the first line -- this file has two function declarations in it.

Matt C

Matt C (view profile)

Needs some TLC and polish; though a good utility function.

Matt C

Matt C (view profile)

Mukhtar Ullah

In continuation to previous remark: in ISWHOLE(X1,X2,..,XN), the arrays X1, X2,... can have different dimenions. How on earth can you vectorize ISWHOLE in that case?

Mukhtar Ullah

Dear Carlos,
You seem to have completely missed what I meant. My dear, in my first syntax ISWHOLE(X), X is an array, which means it can be a vector or matrix. My second syntax ISWHOLE(X1,X2,..,XN) is for the general case when X1, X2 ,.. XN are arrays (vectors or matices). Matlab is an array oriented language, so I don't have to write that explicitely. Matlab users get it usually.

Carlos Adrian Vargas Aguilera

What? Do you really think so, Ullah? It's Matlab! Check out like i said, Fibonacci.m or my roundd.m, is easy my friend... and then the input can be [X1,X2,..,XN] or a matrix...

Ullah Mukhtar

Carlos,
If you only consider the first syntax I provide ,ISWHOLE(X), then you are right. I don't need varargin. The if part of the if-else structure is vectorized already. However, the non-vectorized else part, corresponds to the 2nd syntx, ISWHOLE(X1,X2,..,XN), which cannot be vectorized, at least with the current Matlab verions.

Carlos Adrián Vargas Aguilera

Good but, why not vectorized? And why not make it for any kind of arrays? There's not need for varargin.

Check the inside of file Fibonacci.m by David Terr.

MATLAB Release
MATLAB 7 (R14)
Acknowledgements

Inspired: Date Odometer class

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video