Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sébastien Villemot
dseries
Commits
ee9a7bde
Commit
ee9a7bde
authored
Nov 10, 2017
by
Houtan Bastani
Browse files
stop with error when length operator is used. closes #35
parent
f4bfaa88
Changes
2
Show whitespace changes
Inline
Side-by-side
src/@dseries/length.m
0 → 100644
View file @
ee9a7bde
function
length
(
o
)
% Overloads size function.
% Copyright (C) 2017 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
error
([
'dseries::length: we do not support the length operator on '
...
'dseries. Please use
''
nobs
''
or
''
vobs
''
'
]);
%@test:1
%$ % Define a dates object
%$ ts = dseries(randn(10,1));
%$ try
%$ p = length(ts)
%$ t(1) = false;
%$ catch
%$ t(1) = true;
%$ end
%$
%$ T = all(t);
%@eof:1
\ No newline at end of file
src/@dseries/subsref.m
View file @
ee9a7bde
...
...
@@ -85,6 +85,9 @@ switch S(1).type
case
'
freq
'
%
Returns
an
integer
characterizing
the
data
frequency
(
1
,
4
,
12
or
52
)
B
=
A
.
dates
.
freq
;
case
'
length
'
error
([
'
dseries
:
:
subsref
:
we
do
not
support
the
length
operator
on
'
...
'
dseries
.
Please
use
''
nobs
''
or
''
vobs
'''
]);
case
'
save
'
%
Save
dseries
object
on
disk
(
default
is
a
mat
file
).
B
=
NaN
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment