No License

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

» Watch video

Highlights from

3.0 | 4 ratings Rate this file 3 Downloads (last 30 days) File Size: 966 Bytes File ID: #6277 Version: 1.0



Mukhtar Ullah (view profile)


15 Nov 2004 (Updated )

True for integers(whole numbers).

| Watch this File

File Information

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.


This file inspired Date Odometer Class.

MATLAB release MATLAB 7 (R14)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (8)
05 Sep 2013

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

20 Apr 2009 Matt C

Matt C (view profile)

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

20 Apr 2009 Matt C

Matt C (view profile)

03 Dec 2006 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?

Comment only
02 Dec 2006 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.

Comment only
22 Nov 2006 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...

Comment only
20 Nov 2006 Ullah Mukhtar

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.

Comment only
11 Nov 2006 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.

Contact us