view scripts/general/is_square.m @ 26:e90ea9cbd4de

[project @ 1993-08-10 20:56:55 by jwe] Initial revision
author jwe
date Tue, 10 Aug 1993 20:56:55 +0000
parents
children 98eb51c870b2
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