source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/qtfm/@quaternion/size.m

Last change on this file was 37, checked in by (none), 15 years ago

Added original make3d

File size: 1.2 KB
Line 
1function [r, c] = size(q, dim)
2% SIZE   Size of matrix.
3% (Quaternion overloading of standard Matlab function.)
4
5% Copyright © 2005 Stephen J. Sangwine and Nicolas Le Bihan.
6% See the file : Copyright.m for further details.
7
8error(nargchk(1, 2, nargin)), error(nargoutchk(0, 2, nargout))
9
10xq = x(q); [xr, xc] = size(xq);
11if ispure(q)
12    if [xr, xc] ~= size(y(q)) | [xr, xc] ~= size(z(q))
13        error('Sizes within object differ.')
14    end
15else
16    if size(s(q)) ~= [xr, xc] | [xr, xc] ~= size(y(q)) | [xr, xc] ~= size(z(q))
17        error('Sizes within object differ.')
18    end
19end
20
21% In what follows, we use the size of the x component of the quaternion, not the size
22% of the scalar part, since this could be empty. Otherwise the choice is arbitrary,
23% since the code above checks that all components of q have the same size.
24
25switch nargout
26case 0
27    switch nargin
28    case 1
29        size(xq)
30    case 2
31        size(xq, dim)
32    end
33case 1
34    switch nargin
35    case 1
36        r = [xr, xc];
37    case 2
38        r = size(xq, dim);
39    end
40case 2
41   switch nargin
42   case 1
43       [r, c] = size(xq);
44   case 2
45       [r, c] = size(xq, dim);
46   end
47otherwise
48   error('Unhandled case.')
49end
50
51
52
Note: See TracBrowser for help on using the repository browser.