Mercurial > hg > octave-lyh
view scripts/general/is_square.m @ 54:98eb51c870b2
[project @ 1993-08-11 21:29:50 by jwe]
author | jwe |
---|---|
date | Wed, 11 Aug 1993 21:30:43 +0000 |
parents | e90ea9cbd4de |
children | 0fda6e1f90e0 |
line wrap: on
line source
function retval = is_square (x) # usage: is_square (x) # # If x is square, then return value is the dimension of x. # otherwise, returns a value of 0 # # See also: size, rows, columns, length, is_matrix, is_scalar, is_vector if (nargin == 1) [nr, nc] = size (x); if (nr == nc) retval = nr; else retval = 0; endif else error ("usage: is_square (x)"); endif endfunction