if~nogui,errordlg('Data must have the same length.','Check Data'),waitforbuttonpress,return,elseerror('Data must have the same length.'),end
end
Nx=length(x);Ny=length(y);
ifsize(x,1)<size(x,2),x=x';end
ifsize(y,1)<size(y,2),y=y';end
ifsize(x,2)>=2
xscale=x(:,1);
if~isempty(find(diff(xscale)<0))% multi-column data vector, each column used as vector component
time_scale_flag=0;
time_scale_flag_x=0;
xscale=(1:length(x))';
end
else
xscale=(1:length(x))';
time_scale_flag=0;
time_scale_flag_x=0;
end
ifsize(y,2)>=2
yscale=y(:,1);
time_scale_flag=1;
if~isempty(find(diff(yscale)<0))
time_scale_flag=0;
yscale=(1:length(y))';
end
iftime_scale_flag&&~time_scale_flag_x% if time-scale given in y, but not in x -> error
if~nogui
errordlg(['A time-scale for the second data is series given, but not for the first!',10,'(The time-scale has to be inlcuded as the first colummn of the first data vector.)'],'Check Data')
waitforbuttonpress
return
else
error(['A time-scale for the second data series is given, but not for the first!',10,'(The time-scale has to be inlcuded as the first colummn of the first data vector.)'])
end
end
else
yscale=(1:length(y))';
time_scale_flag=0;
end
iftime_scale_flag_x&&~time_scale_flag% if time-scale given in x, but not in y
iflength(x)~=length(y)
if~nogui
errordlg(['If you are using the time-scale given by the first vector also for',10,'the second vector, both vectors should have the same size!'],'Check Data')
waitforbuttonpress
return
else
error(['If you are using the time-scale given by the first vector also for',10,'the second vector, both vectors should have the same size!'])
end
end
y=[xscale,y];
yscale=xscale;
time_scale_flag=1;
end
ife<0,
e=1;
if~nogui
warndlg('The threshold size E can not be negative and is now set to 1.','Check Data')
waitforbuttonpress
h=findobj('Tag','crqa_eps');
if~isempty(h),set(h(1),'String',num2str(e)),end
else
disp('The threshold size E can not be negative and is now set to 1.'),
end
end
ift<1,
t=1;
if~nogui
warndlg('The delay T can not be smaller than one and is now set to 1.','Check Data')
waitforbuttonpress
h=findobj('Tag','crqa_maxLag');
if~isempty(h),set(h(1),'String',num2str(t)),end
else
disp('The delay T can not be smaller than one and is now set to 1.')
end
end
ifisempty(w),w=Nx;wstep=1;end
ifw<5+(m-1)*t,
w=5+(m-1)*t;
if~nogui,warndlg('The window size W exceeds the valid range.','Check Data')
waitforbuttonpress
h=findobj('Tag','crqa_w');
if~isempty(h),set(h(1),'String',num2str(w)),end
else,disp('The window size W exceeds the valid range.'),end
end
ifw>Nx,
w=Nx;wstep=1;;
if~nogui,warndlg('The window size W exceeds the valid range.','Check Data')
waitforbuttonpress
h=findobj('Tag','crqa_w');
if~isempty(h),set(h(1),'String',num2str(w)),end
else,disp('The window size W exceeds the valid range.'),end
end
ifwstep<1|wstep>Nx/3,
wstep=2;
if~nogui,warndlg('The window shifting value WS exceeds the valid range.','Check Data')
set(h(1),'ToolTip','Stops the computation.','String','Stop','Callback','set(0,''ShowHidden'',''on'');h=findobj(''tag'',''crqa_button_apply'');set(h(1),''String'',''Stopped'');set(0,''ShowHidden'',''off'')')