No BSD License  

Highlights from
ISWHOLE

2.0

2.0 | 3 ratings Rate this file 6 Downloads (last 30 days) File Size: 966 Bytes File ID: #6277

ISWHOLE

by Mukhtar Ullah

 

15 Nov 2004 (Updated 12 Mar 2007)

True for integers(whole numbers).

| Watch this File

File Information
Description

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.

MATLAB release MATLAB 7 (R14)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (7)
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.

20 Nov 2006 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.

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...

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.

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?

20 Apr 2009 Matt C  
20 Apr 2009 Matt C

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

Please login to add a comment or rating.
Updates
12 Mar 2007

Modified, as suggested by Josef Lotz, to provide indices of integer elements.

Tag Activity for this File
Tag Applied By Date/Time
integer Mukhtar Ullah 22 Oct 2008 07:35:48
whole number Mukhtar Ullah 22 Oct 2008 07:35:48
true Mukhtar Ullah 22 Oct 2008 07:35:48
elements Mukhtar Ullah 22 Oct 2008 07:35:48

Contact us at files@mathworks.com