Changed @dynDates/subsref so that the selection of a single element in a dynDates object returns a dynDates object with one element (not a dynDate object).
parent
153fe1ca82
commit
049ba8d527
|
@ -73,21 +73,14 @@ switch S(1).type
|
||||||
error('dynDates::subsref: Unknown public member or method!')
|
error('dynDates::subsref: Unknown public member or method!')
|
||||||
end
|
end
|
||||||
case '()'
|
case '()'
|
||||||
if isscalar(S(1).subs{1})
|
% Extract some dates.
|
||||||
if isint(S(1).subs{1}) && S(1).subs{1}>0 && S(1).subs{1}<=A.ndat
|
if isvector(S(1).subs{1}) && all(isint(S(1).subs{1})) && all(S(1).subs{1}>0) && all(S(1).subs{1}<=A.ndat)
|
||||||
B = dynDate(A.time(S(1).subs{1},:),A.freq);
|
B = dynDates();
|
||||||
else
|
B.freq = A.freq;
|
||||||
error(['dynDates::subsref: the index has to be a positive integer less than or equal to ' int2str(A.ndat) '!'])
|
B.time = A.time(S(1).subs{1},:);
|
||||||
end
|
B.ndat = length(S(1).subs{1});
|
||||||
else
|
else
|
||||||
if isvector(S(1).subs{1}) && all(isint(S(1).subs{1})) && all(S(1).subs{1}>0) && all(S(1).subs{1}<=A.ndat)
|
error(['dynDates::subsref: indices has to be a vector of positive integers less than or equal to ' int2str(A.ndat) '!'])
|
||||||
B = dynDates();
|
|
||||||
B.freq = A.freq;
|
|
||||||
B.time = A.time(S(1).subs{1},:);
|
|
||||||
B.ndat = length(S(1).subs{1});
|
|
||||||
else
|
|
||||||
error(['dynDates::subsref: indices has to be a vector of positive integers less than or equal to ' int2str(A.ndat) '!'])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
otherwise
|
otherwise
|
||||||
error('dynDates::subsref: Something is wrong in your syntax!')
|
error('dynDates::subsref: Something is wrong in your syntax!')
|
||||||
|
|
Loading…
Reference in New Issue