Check that size and save methods (dynSeries) come in last position.

time-shift
Stéphane Adjemian (Charybdis) 2013-09-03 16:39:02 +02:00
parent 15df9972b6
commit 7dfbb903ea
1 changed files with 24 additions and 7 deletions

View File

@ -90,19 +90,36 @@ switch S(1).type
end end
case {'save'} % Save dynSeries object on disk (default is a csv file). case {'save'} % Save dynSeries object on disk (default is a csv file).
B = NaN; B = NaN;
if length(S)==2 && strcmp(S(2).type,'()') if isequal(length(S),2)
save(A,S(2).subs{:}); if strcmp(S(2).type,'()')
S = shiftS(S); if isempty(S(2).subs)
else save(A,inputname(1));
else
save(A,S(2).subs{:});
end
S = shiftS(S);
else
error('dynSeries::subsref: Wrong syntax.')
end
elseif isequal(length(S),1)
save(A,inputname(1)); save(A,inputname(1));
else
error('dynSeries::subsref: Call to save method must come in last position!')
end end
case {'size'} case {'size'}
if length(S)==2 && strcmp(S(2).type,'()') && ~isempty(S(2).subs) if isequal(length(S),2) && strcmp(S(2).type,'()')
B = size(A,S(2).subs{1}); if isempty(S(2).subs)
[x,y] = size(A);
B = [x, y];
else
B = size(A,S(2).subs{1});
end
S = shiftS(S); S = shiftS(S);
else elseif isequal(length(S),1)
[x,y] = size(A); [x,y] = size(A);
B = [x, y]; B = [x, y];
else
error('dynSeries::subsref: Call to size method must come in last position!')
end end
case {'rename','tex_rename'} case {'rename','tex_rename'}
B = feval(S(1).subs,A,S(2).subs{:}); B = feval(S(1).subs,A,S(2).subs{:});