-
Notifications
You must be signed in to change notification settings - Fork 8
/
matrix3d.m
35 lines (34 loc) · 930 Bytes
/
matrix3d.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
classdef matrix3d < double
properties
d3 = 1;
end
methods
function obj = matrix3d(data,d3)
obj = obj@double(data);
obj.d3 = d3;
end
function obj = subsref(A,S)
SS = S;
SS.subs ={S.subs{1},S.subs{2},1};
obj = builtin('subsref',double(A),SS);
end
function varargout = size(obj,varargin)
if numel(varargin)
siz = builtin('size',double(obj),varargin{:});
if varargin{1} == 3
siz = obj.d3;
end
else
siz = builtin('size',double(obj));
siz(3) = obj.d3;
end
if (nargout == 1)
varargout{1} = siz;
else
for i = 1:nargout
varargout{i} = siz(i);
end
end
end
end
end