comparison 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
comparison
equal deleted inserted replaced
25:1d4cfd89ebb6 26:e90ea9cbd4de
1 function retval = is_square (x)
2
3 # usage: is_square (x)
4 #
5 # If x is square, then return value is the dimension of x.
6 # otherwise, returns a value of 0
7 #
8 # See also: size, rows, columns, length, is_matrix, is_scalar, is_vector
9
10 if (nargin == 1)
11 [nr, nc] = size (x);
12 if( nr == nc)
13 retval = nr;
14 else
15 retval = 0;
16 endif
17 else
18 error ("usage: is_square (x)");
19 endif
20
21 endfunction