Mercurial > forge
view extra/ver20/isreal.m @ 0:6b33357c7561 octave-forge
Initial revision
author | pkienzle |
---|---|
date | Wed, 10 Oct 2001 19:54:49 +0000 |
parents | |
children |
line wrap: on
line source
## usage: b = isreal(x) ## ## Returns 1 if all elements of x are real. function b = isreal(x) if (nargin != 1) usage("b = isreal(x)"); endif b = !any(any(imag(x))); endfunction %!shared x %! x=rand(10,10); %!assert (isreal (x)); %!test x(5,1)=1i; %!assert (!isreal (x)); %!assert (isreal ([])); %!error isreal %!error isreal(1,2)