1 ## Copyright (C) 2010 Lukas F. Reichlin
3 ## This program is free software: you can redistribute it and/or modify
4 ## it under the terms of the GNU General Public License as published by
5 ## the Free Software Foundation, either version 3 of the License, or
6 ## (at your option) any later version.
8 ## This program is distributed in the hope that it will be useful,
9 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 ## GNU General Public License for more details.
13 ## You should have received a copy of the GNU General Public License
14 ## along with this program. If not, see <http://www.gnu.org/licenses/>.
17 ## @deftypefn {Function File} {@var{nvec} =} size (@var{q})
18 ## @deftypefnx {Function File} {@var{n} =} size (@var{q}, @var{dim})
19 ## @deftypefnx {Function File} {[@var{nx}, @var{ny}, @dots{}] =} size (@var{q})
20 ## Return size of quaternion arrays.
27 ## If given a second argument, @command{size} will return the size of the
28 ## corresponding dimension.
34 ## Row vector. The first element is the number of rows and the second
35 ## element the number of columns. If @var{q} is an n-dimensional array
36 ## of quaternions, the n-th element of @var{nvec} corresponds to the
37 ## size of the n-th dimension of @var{q}.
39 ## Scalar value. The size of the dimension @var{dim}.
45 ## Sizes of the 3rd to n-th dimensions.
49 ## Author: Lukas Reichlin <lukas.reichlin@gmail.com>
53 function varargout = size (a, b)
58 case 1 # nvec = size (q)
59 varargout{1} = size (a.w);
60 case 2 # n = size (q, dim)
61 varargout{1} = size (a.w, b);
67 if (nargin == 1) # [nx, ny, ...] = size (q)
68 varargout = num2cell (size (a.w));