diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000..5008ddf
Binary files /dev/null and b/.DS_Store differ
diff --git a/._Developer b/._Developer
new file mode 100644
index 0000000..2af7e54
Binary files /dev/null and b/._Developer differ
diff --git a/._Documentation b/._Documentation
new file mode 100644
index 0000000..2af7e54
Binary files /dev/null and b/._Documentation differ
diff --git a/._Sample Data b/._Sample Data
new file mode 100644
index 0000000..2af7e54
Binary files /dev/null and b/._Sample Data differ
diff --git a/._gui_export.mat b/._gui_export.mat
new file mode 100644
index 0000000..32f87f2
Binary files /dev/null and b/._gui_export.mat differ
diff --git a/._kardia.jpg b/._kardia.jpg
new file mode 100644
index 0000000..32f87f2
Binary files /dev/null and b/._kardia.jpg differ
diff --git a/._kardia.m b/._kardia.m
new file mode 100644
index 0000000..89901c6
Binary files /dev/null and b/._kardia.m differ
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..dfe0770
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,2 @@
+# Auto detect text files and perform LF normalization
+* text=auto
diff --git a/Developer/._colors.m b/Developer/._colors.m
new file mode 100644
index 0000000..32f87f2
Binary files /dev/null and b/Developer/._colors.m differ
diff --git a/Developer/._gui.fig b/Developer/._gui.fig
new file mode 100644
index 0000000..32f87f2
Binary files /dev/null and b/Developer/._gui.fig differ
diff --git a/Developer/._gui.m b/Developer/._gui.m
new file mode 100644
index 0000000..32f87f2
Binary files /dev/null and b/Developer/._gui.m differ
diff --git a/Developer/._gui_export.m b/Developer/._gui_export.m
new file mode 100644
index 0000000..32f87f2
Binary files /dev/null and b/Developer/._gui_export.m differ
diff --git a/Developer/colors.m b/Developer/colors.m
new file mode 100644
index 0000000..e0a4407
--- /dev/null
+++ b/Developer/colors.m
@@ -0,0 +1,8 @@
+% colors
+icolor(:,1)=[162 38 109]/255;
+icolor(:,2)=[0 96 255]/255;
+icolor(:,3)=[80 162 84]/255;
+icolor(:,4)=[192 119 38]/255;
+icolor(:,5)=[239 0 0]/255;
+icolor(:,6)=[0 0 0];
+icolor(:,7)=[0.5 0.3 1];
diff --git a/Developer/gui.fig b/Developer/gui.fig
new file mode 100644
index 0000000..563bc37
Binary files /dev/null and b/Developer/gui.fig differ
diff --git a/Developer/gui.m b/Developer/gui.m
new file mode 100644
index 0000000..81bd821
--- /dev/null
+++ b/Developer/gui.m
@@ -0,0 +1,928 @@
+function varargout = gui(varargin)
+%GUI M-file for gui.fig
+% GUI, by itself, creates a new GUI or raises the existing
+% singleton*.
+%
+% H = GUI returns the handle to a new GUI or the handle to
+% the existing singleton*.
+%
+% GUI('Property','Value',...) creates a new GUI using the
+% given property value pairs. Unrecognized properties are passed via
+% varargin to gui_OpeningFcn. This calling syntax produces a
+% warning when there is an existing singleton*.
+%
+% GUI('CALLBACK') and GUI('CALLBACK',hObject,...) call the
+% local function named CALLBACK in GUI.M with the given input
+% arguments.
+%
+% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
+% instance to run (singleton)".
+%
+% See also: GUIDE, GUIDATA, GUIHANDLES
+
+% Edit the above text to modify the response to help gui
+
+% Last Modified by GUIDE v2.5 04-Aug-2008 19:34:38
+
+% Begin initialization code - DO NOT EDIT
+gui_Singleton = 1;
+gui_State = struct('gui_Name', mfilename, ...
+ 'gui_Singleton', gui_Singleton, ...
+ 'gui_OpeningFcn', @gui_OpeningFcn, ...
+ 'gui_OutputFcn', @gui_OutputFcn, ...
+ 'gui_LayoutFcn', [], ...
+ 'gui_Callback', []);
+if nargin && ischar(varargin{1})
+ gui_State.gui_Callback = str2func(varargin{1});
+end
+
+if nargout
+ [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
+else
+ gui_mainfcn(gui_State, varargin{:});
+end
+% End initialization code - DO NOT EDIT
+
+
+% --- Executes just before gui is made visible.
+function gui_OpeningFcn(hObject, eventdata, handles, varargin)
+% This function has no output args, see OutputFcn.
+% hObject handle to figure
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+% varargin unrecognized PropertyName/PropertyValue pairs from the
+% command line (see VARARGIN)
+
+% Choose default command line output for gui
+handles.output = hObject;
+
+% Update handles structure
+guidata(hObject, handles);
+
+% UIWAIT makes gui wait for user response (see UIRESUME)
+% uiwait(handles.figure1);
+
+
+% --- Outputs from this function are returned to the command line.
+function varargout = gui_OutputFcn(hObject, eventdata, handles)
+% varargout cell array for returning output args (see VARARGOUT);
+% hObject handle to figure
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Get default command line output from handles structure
+varargout{1} = handles.output;
+
+
+% --- Executes on button press in pushbutton1.
+function pushbutton1_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+
+function edit1_Callback(hObject, eventdata, handles)
+% hObject handle to edit1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit1 as text
+% str2double(get(hObject,'String')) returns contents of edit1 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit1_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit2_Callback(hObject, eventdata, handles)
+% hObject handle to edit2 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit2 as text
+% str2double(get(hObject,'String')) returns contents of edit2 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit2_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit2 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on selection change in popupmenu1.
+function popupmenu1_Callback(hObject, eventdata, handles)
+% hObject handle to popupmenu1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: contents = get(hObject,'String') returns popupmenu1 contents as cell array
+% contents{get(hObject,'Value')} returns selected item from popupmenu1
+
+
+% --- Executes during object creation, after setting all properties.
+function popupmenu1_CreateFcn(hObject, eventdata, handles)
+% hObject handle to popupmenu1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: popupmenu controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on selection change in popupmenu3.
+function popupmenu3_Callback(hObject, eventdata, handles)
+% hObject handle to popupmenu3 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: contents = get(hObject,'String') returns popupmenu3 contents as cell array
+% contents{get(hObject,'Value')} returns selected item from popupmenu3
+
+
+% --- Executes during object creation, after setting all properties.
+function popupmenu3_CreateFcn(hObject, eventdata, handles)
+% hObject handle to popupmenu3 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: popupmenu controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit3_Callback(hObject, eventdata, handles)
+% hObject handle to edit3 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit3 as text
+% str2double(get(hObject,'String')) returns contents of edit3 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit3_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit3 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on selection change in popupmenu4.
+function popupmenu4_Callback(hObject, eventdata, handles)
+% hObject handle to popupmenu4 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: contents = get(hObject,'String') returns popupmenu4 contents as cell array
+% contents{get(hObject,'Value')} returns selected item from popupmenu4
+
+
+% --- Executes during object creation, after setting all properties.
+function popupmenu4_CreateFcn(hObject, eventdata, handles)
+% hObject handle to popupmenu4 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: popupmenu controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit4_Callback(hObject, eventdata, handles)
+% hObject handle to edit4 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit4 as text
+% str2double(get(hObject,'String')) returns contents of edit4 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit4_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit4 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit5_Callback(hObject, eventdata, handles)
+% hObject handle to edit5 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit5 as text
+% str2double(get(hObject,'String')) returns contents of edit5 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit5_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit5 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on button press in pushbutton2.
+function pushbutton2_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton2 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton3.
+function pushbutton3_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton3 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+
+function edit6_Callback(hObject, eventdata, handles)
+% hObject handle to edit6 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit6 as text
+% str2double(get(hObject,'String')) returns contents of edit6 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit6_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit6 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit7_Callback(hObject, eventdata, handles)
+% hObject handle to edit7 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit7 as text
+% str2double(get(hObject,'String')) returns contents of edit7 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit7_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit7 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit8_Callback(hObject, eventdata, handles)
+% hObject handle to edit8 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit8 as text
+% str2double(get(hObject,'String')) returns contents of edit8 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit8_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit8 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on selection change in popupmenu5.
+function popupmenu5_Callback(hObject, eventdata, handles)
+% hObject handle to popupmenu5 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: contents = get(hObject,'String') returns popupmenu5 contents as cell array
+% contents{get(hObject,'Value')} returns selected item from popupmenu5
+
+
+% --- Executes during object creation, after setting all properties.
+function popupmenu5_CreateFcn(hObject, eventdata, handles)
+% hObject handle to popupmenu5 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: popupmenu controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit9_Callback(hObject, eventdata, handles)
+% hObject handle to edit9 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit9 as text
+% str2double(get(hObject,'String')) returns contents of edit9 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit9_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit9 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on button press in checkbox1.
+function checkbox1_Callback(hObject, eventdata, handles)
+% hObject handle to checkbox1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hint: get(hObject,'Value') returns toggle state of checkbox1
+
+
+% --- Executes on button press in pushbutton4.
+function pushbutton4_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton4 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton9.
+function pushbutton9_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton9 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton10.
+function pushbutton10_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton10 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton11.
+function pushbutton11_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton11 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton12.
+function pushbutton12_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton12 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton5.
+function pushbutton5_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton5 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton6.
+function pushbutton6_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton6 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton7.
+function pushbutton7_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton7 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton8.
+function pushbutton8_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton8 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton13.
+function pushbutton13_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton13 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+
+function edit10_Callback(hObject, eventdata, handles)
+% hObject handle to edit10 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit10 as text
+% str2double(get(hObject,'String')) returns contents of edit10 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit10_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit10 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit11_Callback(hObject, eventdata, handles)
+% hObject handle to edit11 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit11 as text
+% str2double(get(hObject,'String')) returns contents of edit11 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit11_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit11 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit12_Callback(hObject, eventdata, handles)
+% hObject handle to edit12 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit12 as text
+% str2double(get(hObject,'String')) returns contents of edit12 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit12_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit12 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on selection change in popupmenu6.
+function popupmenu6_Callback(hObject, eventdata, handles)
+% hObject handle to popupmenu6 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: contents = get(hObject,'String') returns popupmenu6 contents as cell array
+% contents{get(hObject,'Value')} returns selected item from popupmenu6
+
+
+% --- Executes during object creation, after setting all properties.
+function popupmenu6_CreateFcn(hObject, eventdata, handles)
+% hObject handle to popupmenu6 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: popupmenu controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on button press in pushbutton14.
+function pushbutton14_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton14 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on selection change in popupmenu7.
+function popupmenu7_Callback(hObject, eventdata, handles)
+% hObject handle to popupmenu7 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: contents = get(hObject,'String') returns popupmenu7 contents as cell array
+% contents{get(hObject,'Value')} returns selected item from popupmenu7
+
+
+% --- Executes during object creation, after setting all properties.
+function popupmenu7_CreateFcn(hObject, eventdata, handles)
+% hObject handle to popupmenu7 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: popupmenu controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on selection change in popupmenu8.
+function popupmenu8_Callback(hObject, eventdata, handles)
+% hObject handle to popupmenu8 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: contents = get(hObject,'String') returns popupmenu8 contents as cell array
+% contents{get(hObject,'Value')} returns selected item from popupmenu8
+
+
+% --- Executes during object creation, after setting all properties.
+function popupmenu8_CreateFcn(hObject, eventdata, handles)
+% hObject handle to popupmenu8 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: popupmenu controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on selection change in popupmenu9.
+function popupmenu9_Callback(hObject, eventdata, handles)
+% hObject handle to popupmenu9 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: contents = get(hObject,'String') returns popupmenu9 contents as cell array
+% contents{get(hObject,'Value')} returns selected item from popupmenu9
+
+
+% --- Executes during object creation, after setting all properties.
+function popupmenu9_CreateFcn(hObject, eventdata, handles)
+% hObject handle to popupmenu9 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: popupmenu controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit14_Callback(hObject, eventdata, handles)
+% hObject handle to edit14 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit14 as text
+% str2double(get(hObject,'String')) returns contents of edit14 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit14_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit14 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on selection change in popupmenu10.
+function popupmenu10_Callback(hObject, eventdata, handles)
+% hObject handle to popupmenu10 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: contents = get(hObject,'String') returns popupmenu10 contents as cell array
+% contents{get(hObject,'Value')} returns selected item from popupmenu10
+
+
+% --- Executes during object creation, after setting all properties.
+function popupmenu10_CreateFcn(hObject, eventdata, handles)
+% hObject handle to popupmenu10 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: popupmenu controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on selection change in popupmenu11.
+function popupmenu11_Callback(hObject, eventdata, handles)
+% hObject handle to popupmenu11 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: contents = get(hObject,'String') returns popupmenu11 contents as cell array
+% contents{get(hObject,'Value')} returns selected item from popupmenu11
+
+
+% --- Executes during object creation, after setting all properties.
+function popupmenu11_CreateFcn(hObject, eventdata, handles)
+% hObject handle to popupmenu11 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: popupmenu controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit15_Callback(hObject, eventdata, handles)
+% hObject handle to edit15 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit15 as text
+% str2double(get(hObject,'String')) returns contents of edit15 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit15_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit15 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+
+function edit16_Callback(hObject, eventdata, handles)
+% hObject handle to edit16 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hints: get(hObject,'String') returns contents of edit16 as text
+% str2double(get(hObject,'String')) returns contents of edit16 as a double
+
+
+% --- Executes during object creation, after setting all properties.
+function edit16_CreateFcn(hObject, eventdata, handles)
+% hObject handle to edit16 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles empty - handles not created until after all CreateFcns called
+
+% Hint: edit controls usually have a white background on Windows.
+% See ISPC and COMPUTER.
+if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
+ set(hObject,'BackgroundColor','white');
+end
+
+
+% --- Executes on button press in checkbox3.
+function checkbox3_Callback(hObject, eventdata, handles)
+% hObject handle to checkbox3 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+% Hint: get(hObject,'Value') returns toggle state of checkbox3
+
+
+% --- Executes on button press in pushbutton20.
+function pushbutton20_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton20 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton16.
+function pushbutton16_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton16 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton17.
+function pushbutton17_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton17 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton18.
+function pushbutton18_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton18 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton19.
+function pushbutton19_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton19 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton15.
+function pushbutton15_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton15 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton21.
+function pushbutton21_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton21 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton22.
+function pushbutton22_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton22 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton23.
+function pushbutton23_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton23 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton24.
+function pushbutton24_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton24 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --------------------------------------------------------------------
+function Untitled_1_Callback(hObject, eventdata, handles)
+% hObject handle to Untitled_1 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton25.
+function pushbutton25_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton25 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton26.
+function pushbutton26_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton26 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton27.
+function pushbutton27_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton27 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton28.
+function pushbutton28_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton28 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton29.
+function pushbutton29_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton29 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton30.
+function pushbutton30_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton30 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton31.
+function pushbutton31_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton31 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton32.
+function pushbutton32_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton32 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton33.
+function pushbutton33_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton33 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton34.
+function pushbutton34_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton34 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton35.
+function pushbutton35_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton35 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
+% --- Executes on button press in pushbutton36.
+function pushbutton36_Callback(hObject, eventdata, handles)
+% hObject handle to pushbutton36 (see GCBO)
+% eventdata reserved - to be defined in a future version of MATLAB
+% handles structure with handles and user data (see GUIDATA)
+
+
diff --git a/Developer/gui_export.m b/Developer/gui_export.m
new file mode 100644
index 0000000..5746793
--- /dev/null
+++ b/Developer/gui_export.m
@@ -0,0 +1,2109 @@
+function h1 = gui_export()
+
+
+load gui_export.mat
+
+
+
+h1 = figure(...
+'Units','characters',...
+'PaperUnits',get(0,'defaultfigurePaperUnits'),...
+'Color',[0.87843137254902 0.874509803921569 0.890196078431373],...
+'Colormap',[0 0 0.5625;0 0 0.625;0 0 0.6875;0 0 0.75;0 0 0.8125;0 0 0.875;0 0 0.9375;0 0 1;0 0.0625 1;0 0.125 1;0 0.1875 1;0 0.25 1;0 0.3125 1;0 0.375 1;0 0.4375 1;0 0.5 1;0 0.5625 1;0 0.625 1;0 0.6875 1;0 0.75 1;0 0.8125 1;0 0.875 1;0 0.9375 1;0 1 1;0.0625 1 1;0.125 1 0.9375;0.1875 1 0.875;0.25 1 0.8125;0.3125 1 0.75;0.375 1 0.6875;0.4375 1 0.625;0.5 1 0.5625;0.5625 1 0.5;0.625 1 0.4375;0.6875 1 0.375;0.75 1 0.3125;0.8125 1 0.25;0.875 1 0.1875;0.9375 1 0.125;1 1 0.0625;1 1 0;1 0.9375 0;1 0.875 0;1 0.8125 0;1 0.75 0;1 0.6875 0;1 0.625 0;1 0.5625 0;1 0.5 0;1 0.4375 0;1 0.375 0;1 0.3125 0;1 0.25 0;1 0.1875 0;1 0.125 0;1 0.0625 0;1 0 0;0.9375 0 0;0.875 0 0;0.8125 0 0;0.75 0 0;0.6875 0 0;0.625 0 0;0.5625 0 0],...
+'IntegerHandle','off',...
+'InvertHardcopy',get(0,'defaultfigureInvertHardcopy'),...
+'MenuBar','none',...
+'Name','KARDIA v2.2',...
+'NumberTitle','off',...
+'PaperPositionMode','auto',...
+'PaperSize',[20.98404194812 29.67743169791],...
+'PaperType',get(0,'defaultfigurePaperType'),...
+'Position',[1.80000000000001 1.38461538461542 201.8 53.0769230769231],...
+'UseHG2','off',...
+'HandleVisibility','callback',...
+'Tag','main_figure',...
+'UserData',[],...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'panel_kardia_image';
+
+h2 = uipanel(...
+'Parent',h1,...
+'Tag','panel_kardia_image',...
+'UserData',[],...
+'Clipping','on',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'Position',[0.0089197224975223 0.649275362318841 0.288404360753221 0.320289855072464],...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'axes_kardia_image';
+
+h3 = axes(...
+'Parent',h2,...
+'Position',[0.0313588850174216 0.0452261306532663 0.944250871080139 1.01005025125628],...
+'CameraPosition',[0.5 0.5 9.16025403784439],...
+'CameraPositionMode',get(0,'defaultaxesCameraPositionMode'),...
+'Color',get(0,'defaultaxesColor'),...
+'ColorOrder',get(0,'defaultaxesColorOrder'),...
+'LooseInset',[0.128882521489971 0.100454545454546 0.0941833810888252 0.0684917355371901],...
+'XColor',get(0,'defaultaxesXColor'),...
+'YColor',get(0,'defaultaxesYColor'),...
+'ZColor',get(0,'defaultaxesZColor'),...
+'Tag','axes_kardia_image',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+h4 = get(h3,'title');
+
+set(h4,...
+'Parent',h3,...
+'Units','data',...
+'FontUnits','points',...
+'BackgroundColor','none',...
+'Color',[0 0 0],...
+'DisplayName',blanks(0),...
+'EdgeColor','none',...
+'EraseMode','normal',...
+'DVIMode','auto',...
+'FontAngle','normal',...
+'FontName','Helvetica',...
+'FontSize',10,...
+'FontWeight','normal',...
+'HorizontalAlignment','center',...
+'LineStyle','-',...
+'LineWidth',0.5,...
+'Margin',2,...
+'Position',[0.5 1.03233830845771 1.00005459937205],...
+'Rotation',0,...
+'String',blanks(0),...
+'Interpreter','tex',...
+'VerticalAlignment','bottom',...
+'ButtonDownFcn',[],...
+'CreateFcn', {@local_CreateFcn, [], ''} ,...
+'DeleteFcn',[],...
+'BusyAction','queue',...
+'HandleVisibility','off',...
+'HelpTopicKey',blanks(0),...
+'HitTest','on',...
+'Interruptible','on',...
+'SelectionHighlight','on',...
+'Serializable','on',...
+'Tag',blanks(0),...
+'UserData',[],...
+'Visible','on',...
+'XLimInclude','on',...
+'YLimInclude','on',...
+'ZLimInclude','on',...
+'CLimInclude','on',...
+'ALimInclude','on',...
+'IncludeRenderer','on',...
+'Clipping','off');
+
+h5 = get(h3,'xlabel');
+
+set(h5,...
+'Parent',h3,...
+'Units','data',...
+'FontUnits','points',...
+'BackgroundColor','none',...
+'Color',[0 0 0],...
+'DisplayName',blanks(0),...
+'EdgeColor','none',...
+'EraseMode','normal',...
+'DVIMode','auto',...
+'FontAngle','normal',...
+'FontName','Helvetica',...
+'FontSize',10,...
+'FontWeight','normal',...
+'HorizontalAlignment','center',...
+'LineStyle','-',...
+'LineWidth',0.5,...
+'Margin',2,...
+'Position',[0.496309963099631 -0.116915422885572 1.00005459937205],...
+'Rotation',0,...
+'String',blanks(0),...
+'Interpreter','tex',...
+'VerticalAlignment','cap',...
+'ButtonDownFcn',[],...
+'CreateFcn', {@local_CreateFcn, [], ''} ,...
+'DeleteFcn',[],...
+'BusyAction','queue',...
+'HandleVisibility','off',...
+'HelpTopicKey',blanks(0),...
+'HitTest','on',...
+'Interruptible','on',...
+'SelectionHighlight','on',...
+'Serializable','on',...
+'Tag',blanks(0),...
+'UserData',[],...
+'Visible','on',...
+'XLimInclude','on',...
+'YLimInclude','on',...
+'ZLimInclude','on',...
+'CLimInclude','on',...
+'ALimInclude','on',...
+'IncludeRenderer','on',...
+'Clipping','off');
+
+h6 = get(h3,'ylabel');
+
+set(h6,...
+'Parent',h3,...
+'Units','data',...
+'FontUnits','points',...
+'BackgroundColor','none',...
+'Color',[0 0 0],...
+'DisplayName',blanks(0),...
+'EdgeColor','none',...
+'EraseMode','normal',...
+'DVIMode','auto',...
+'FontAngle','normal',...
+'FontName','Helvetica',...
+'FontSize',10,...
+'FontWeight','normal',...
+'HorizontalAlignment','center',...
+'LineStyle','-',...
+'LineWidth',0.5,...
+'Margin',2,...
+'Position',[-0.105166051660517 0.49502487562189 1.00005459937205],...
+'Rotation',90,...
+'String',blanks(0),...
+'Interpreter','tex',...
+'VerticalAlignment','bottom',...
+'ButtonDownFcn',[],...
+'CreateFcn', {@local_CreateFcn, [], ''} ,...
+'DeleteFcn',[],...
+'BusyAction','queue',...
+'HandleVisibility','off',...
+'HelpTopicKey',blanks(0),...
+'HitTest','on',...
+'Interruptible','on',...
+'SelectionHighlight','on',...
+'Serializable','on',...
+'Tag',blanks(0),...
+'UserData',[],...
+'Visible','on',...
+'XLimInclude','on',...
+'YLimInclude','on',...
+'ZLimInclude','on',...
+'CLimInclude','on',...
+'ALimInclude','on',...
+'IncludeRenderer','on',...
+'Clipping','off');
+
+h7 = get(h3,'zlabel');
+
+set(h7,...
+'Parent',h3,...
+'Units','data',...
+'FontUnits','points',...
+'BackgroundColor','none',...
+'Color',[0 0 0],...
+'DisplayName',blanks(0),...
+'EdgeColor','none',...
+'EraseMode','normal',...
+'DVIMode','auto',...
+'FontAngle','normal',...
+'FontName','Helvetica',...
+'FontSize',10,...
+'FontWeight','normal',...
+'HorizontalAlignment','right',...
+'LineStyle','-',...
+'LineWidth',0.5,...
+'Margin',2,...
+'Position',[-0.0756457564575646 1.14179104477612 1.00005459937205],...
+'Rotation',0,...
+'String',blanks(0),...
+'Interpreter','tex',...
+'VerticalAlignment','middle',...
+'ButtonDownFcn',[],...
+'CreateFcn', {@local_CreateFcn, [], ''} ,...
+'DeleteFcn',[],...
+'BusyAction','queue',...
+'HandleVisibility','off',...
+'HelpTopicKey',blanks(0),...
+'HitTest','on',...
+'Interruptible','on',...
+'SelectionHighlight','on',...
+'Serializable','on',...
+'Tag',blanks(0),...
+'UserData',[],...
+'Visible','off',...
+'XLimInclude','on',...
+'YLimInclude','on',...
+'ZLimInclude','on',...
+'CLimInclude','on',...
+'ALimInclude','on',...
+'IncludeRenderer','on',...
+'Clipping','off');
+
+appdata = [];
+appdata.lastValidTag = 'panel_HRV';
+
+h8 = uipanel(...
+'Parent',h1,...
+'Title','HRV',...
+'Tag','panel_HRV',...
+'UserData',[],...
+'Clipping','on',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'Position',[0.306243805748266 0.0115942028985507 0.278493557978196 0.972463768115942],...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'panel_epochdata_HRV';
+
+h9 = uipanel(...
+'Parent',h8,...
+'Title','Epoch Data',...
+'Tag','panel_epochdata_HRV',...
+'UserData',[],...
+'Clipping','on',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'Position',[0.0323741007194245 0.788148148148148 0.93884892086331 0.198518518518519],...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'push_selectevents_HRV';
+
+h10 = uicontrol(...
+'Parent',h9,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'Callback','HRVselectevents_callback',...
+'Position',[0.02734375 0.728070175438596 0.30078125 0.228070175438596],...
+'String','Select events',...
+'Tag','push_selectevents_HRV',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_epochstart_HRV';
+
+h11 = uicontrol(...
+'Parent',h9,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'HorizontalAlignment','left',...
+'Position',[0.02734375 0.508771929824561 0.22265625 0.12280701754386],...
+'String','Epoch start',...
+'Style','text',...
+'Tag','txt_epochstart_HRV',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'edit_epochend_HRV';
+
+h12 = uicontrol(...
+'Parent',h9,...
+'Units','normalized',...
+'BackgroundColor',[1 1 1],...
+'Position',[0.696528453307393 0.478870145259429 0.151750972762646 0.186440677966102],...
+'String','1',...
+'Style','edit',...
+'Value',1,...
+'Tag','edit_epochend_HRV',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_epochend_HRV';
+
+h13 = uicontrol(...
+'Parent',h9,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'HorizontalAlignment','left',...
+'Position',[0.463065418287938 0.512768450344175 0.206225680933852 0.127118644067797],...
+'String','Epoch end',...
+'Style','text',...
+'Tag','txt_epochend_HRV',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'edit_epochstart_HRV';
+
+h14 = uicontrol(...
+'Parent',h9,...
+'Units','normalized',...
+'BackgroundColor',[1 1 1],...
+'Position',[0.287968142023346 0.478870145259429 0.147859922178988 0.177966101694915],...
+'String','1',...
+'Style','edit',...
+'Value',1,...
+'Tag','edit_epochstart_HRV',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'push_rejectartifacts_HRV';
+
+h15 = uicontrol(...
+'Parent',h9,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'Callback','rejectartifacts_callback',...
+'Position',[0.02734375 0.114035087719298 0.33203125 0.210526315789474],...
+'String','Reject artifacts',...
+'Tag','push_rejectartifacts_HRV',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'push_epochdata_HRV';
+
+h16 = uicontrol(...
+'Parent',h9,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'Callback','epochdata_callback',...
+'Position',[0.4375 0.114035087719298 0.20703125 0.201754385964912],...
+'String','ok',...
+'Tag','push_epochdata_HRV',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'panel_spectral';
+
+h17 = uipanel(...
+'Parent',h8,...
+'Title','Spectral Analysis',...
+'Tag','panel_spectral',...
+'UserData',[],...
+'Clipping','on',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'Position',[0.0324909747292419 0.270229007633588 0.942238267148015 0.493129770992366],...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_samplerate';
+
+h18 = uicontrol(...
+'Parent',h17,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'HorizontalAlignment','left',...
+'Position',[0.0350194552529183 0.920634920634921 0.252918287937743 0.0476190476190476],...
+'String','Sample Rate',...
+'Style','text',...
+'Tag','txt_samplerate',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'pop_samplerate';
+
+h19 = uicontrol(...
+'Parent',h17,...
+'Units','normalized',...
+'BackgroundColor',[1 1 1],...
+'Position',[0.385214007782101 0.898412698412699 0.21011673151751 0.073015873015873],...
+'String',{ '2'; '4' },...
+'Style','popupmenu',...
+'Value',1,...
+'Tag','pop_samplerate',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_detrendmethod';
+
+h20 = uicontrol(...
+'Parent',h17,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'HorizontalAlignment','left',...
+'Position',[0.0350194552529183 0.676190476190476 0.307392996108949 0.053968253968254],...
+'String','Detrend method',...
+'Style','text',...
+'Tag','txt_detrendmethod',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'push_ok_spectral';
+
+h21 = uicontrol(...
+'Parent',h17,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'Callback','spectralanalysis_callback',...
+'Position',[0.385214007782101 0.0507936507936508 0.206225680933852 0.0761904761904762],...
+'String','ok',...
+'Tag','push_ok_spectral',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_points';
+
+h22 = uicontrol(...
+'Parent',h17,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'HorizontalAlignment','left',...
+'Position',[0.0350194552529183 0.793650793650794 0.136186770428016 0.0634920634920635],...
+'String','Points',...
+'Style','text',...
+'Tag','txt_points',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_windowing';
+
+h23 = uicontrol(...
+'Parent',h17,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'HorizontalAlignment','left',...
+'Position',[0.03515625 0.557377049180328 0.21875 0.0524590163934426],...
+'String','Windowing',...
+'Style','text',...
+'Tag','txt_windowing',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_ARorder';
+
+h24 = uicontrol(...
+'Parent',h17,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'HorizontalAlignment','left',...
+'Position',[0.0350194552529183 0.311111111111111 0.217898832684825 0.0476190476190476],...
+'String','AR order',...
+'Style','text',...
+'Tag','txt_ARorder',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_algorithm_spectral';
+
+h25 = uicontrol(...
+'Parent',h17,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'HorizontalAlignment','left',...
+'Position',[0.0350194552529183 0.422222222222222 0.21011673151751 0.073015873015873],...
+'String','Algorithm',...
+'Style','text',...
+'Tag','txt_algorithm_spectral',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_scale';
+
+h26 = uicontrol(...
+'Parent',h17,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'HorizontalAlignment','left',...
+'Position',[0.0350194552529183 0.193650793650794 0.151750972762646 0.053968253968254],...
+'String','Scale',...
+'Style','text',...
+'Tag','txt_scale',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'pop_detrendmethod';
+
+h27 = uicontrol(...
+'Parent',h17,...
+'Units','normalized',...
+'BackgroundColor',[1 1 1],...
+'Position',[0.390625 0.668852459016393 0.3125 0.0655737704918033],...
+'String',{ 'constant'; 'linear' },...
+'Style','popupmenu',...
+'Value',1,...
+'Tag','pop_detrendmethod',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'pop_points';
+
+h28 = uicontrol(...
+'Parent',h17,...
+'Units','normalized',...
+'BackgroundColor',[1 1 1],...
+'Position',[0.389105058365759 0.79047619047619 0.21011673151751 0.073015873015873],...
+'String',{ '512'; '1024' },...
+'Style','popupmenu',...
+'Value',1,...
+'Tag','pop_points',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'pop_windowing';
+
+h29 = uicontrol(...
+'Parent',h17,...
+'Units','normalized',...
+'BackgroundColor',[1 1 1],...
+'Position',[0.390625 0.554098360655738 0.31640625 0.0655737704918033],...
+'String',{ 'Hanning'; 'Hamming'; 'Blackman'; 'Bartlett' },...
+'Style','popupmenu',...
+'Value',1,...
+'Tag','pop_windowing',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'edit_ARorder';
+
+h30 = uicontrol(...
+'Parent',h17,...
+'Units','normalized',...
+'BackgroundColor',[1 1 1],...
+'Position',[0.389105058365759 0.298412698412699 0.151750972762646 0.0666666666666667],...
+'String','16',...
+'Style','edit',...
+'Value',1,...
+'Tag','edit_ARorder',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'pop_algorithm_spectral';
+
+h31 = uicontrol(...
+'Parent',h17,...
+'Units','normalized',...
+'BackgroundColor',[1 1 1],...
+'Position',[0.390625 0.429508196721312 0.30078125 0.0688524590163934],...
+'String',{ 'FFT'; 'AR-Burg' },...
+'Style','popupmenu',...
+'Value',1,...
+'Tag','pop_algorithm_spectral',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'pop_scale';
+
+h32 = uicontrol(...
+'Parent',h17,...
+'Units','normalized',...
+'BackgroundColor',[1 1 1],...
+'Position',[0.390625 0.19016393442623 0.29296875 0.0655737704918033],...
+'String',{ 'normal '; 'log'; 'monolog' },...
+'Style','popupmenu',...
+'Value',1,...
+'Tag','pop_scale',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'panel_DFA';
+
+h33 = uipanel(...
+'Parent',h8,...
+'Title','DFA',...
+'Tag','panel_DFA',...
+'UserData',[],...
+'Clipping','on',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'Position',[0.0323741007194245 0.028148148148148 0.942446043165468 0.21037037037037],...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_minbox';
+
+h34 = uicontrol(...
+'Parent',h33,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'HorizontalAlignment','left',...
+'Position',[0.0193798449612403 0.73015873015873 0.151162790697675 0.134920634920635],...
+'String','Minbox',...
+'Style','text',...
+'Tag','txt_minbox',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_maxbox';
+
+h35 = uicontrol(...
+'Parent',h33,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'HorizontalAlignment','left',...
+'Position',[0.387596899224806 0.73015873015873 0.162790697674419 0.134920634920635],...
+'String','Maxbox',...
+'Style','text',...
+'Tag','txt_maxbox',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'edit_minbox';
+
+h36 = uicontrol(...
+'Parent',h33,...
+'Units','normalized',...
+'BackgroundColor',[1 1 1],...
+'Position',[0.178294573643411 0.706349206349206 0.131782945736434 0.19047619047619],...
+'String','1',...
+'Style','edit',...
+'Value',1,...
+'Tag','edit_minbox',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'check_slidingwins';
+
+h37 = uicontrol(...
+'Parent',h33,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'Position',[0.0193798449612403 0.444444444444445 0.391472868217054 0.119047619047619],...
+'String','sliding windows',...
+'Style','checkbox',...
+'Value',1,...
+'Tag','check_slidingwins',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'push_ok_DFA';
+
+h38 = uicontrol(...
+'Parent',h33,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'Callback','dfa_callback',...
+'Position',[0.383720930232558 0.134920634920635 0.205426356589147 0.19047619047619],...
+'String','ok',...
+'Tag','push_ok_DFA',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'edit_maxbox';
+
+h39 = uicontrol(...
+'Parent',h33,...
+'Units','normalized',...
+'BackgroundColor',[1 1 1],...
+'Position',[0.562015503875969 0.706349206349206 0.131782945736434 0.19047619047619],...
+'String','1',...
+'Style','edit',...
+'Value',1,...
+'Tag','edit_maxbox',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'panel_import_data';
+
+h40 = uipanel(...
+'Parent',h1,...
+'Title','Import Data',...
+'Tag','panel_import_data',...
+'UserData',[],...
+'Clipping','on',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'Position',[0.00792864222001982 0.373913043478261 0.150644202180377 0.26231884057971],...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_channel_data';
+
+h41 = uicontrol(...
+'Parent',h40,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'HorizontalAlignment','left',...
+'Position',[0.0273972602739726 0.872727272727273 0.321917808219178 0.0909090909090909],...
+'String','Channel',...
+'Style','text',...
+'Tag','txt_channel_data',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_datavar_data';
+
+h42 = uicontrol(...
+'Parent',h40,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'HorizontalAlignment','left',...
+'Position',[0.027027027027027 0.660606060606061 0.290540540540541 0.109090909090909],...
+'String','Data var',...
+'Style','text',...
+'Tag','txt_datavar_data',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_unit_data';
+
+h43 = uicontrol(...
+'Parent',h40,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'HorizontalAlignment','left',...
+'Position',[0.0297619047619047 0.272727272727273 0.172619047619048 0.0909090909090909],...
+'String','Unit',...
+'Style','text',...
+'Tag','txt_unit_data',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_format_data';
+
+h44 = uicontrol(...
+'Parent',h40,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'HorizontalAlignment','left',...
+'Position',[0.0297619047619047 0.484848484848485 0.244047619047619 0.0727272727272727],...
+'String','Format',...
+'Style','text',...
+'Tag','txt_format_data',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'edit_channel_data';
+
+h45 = uicontrol(...
+'Parent',h40,...
+'Units','normalized',...
+'BackgroundColor',[1 1 1],...
+'CData',[],...
+'Position',[0.349315068493149 0.848484848484849 0.246575342465753 0.127272727272727],...
+'String','1',...
+'Style','edit',...
+'Value',1,...
+'Tag','edit_channel_data',...
+'UserData',[],...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'edit_unit_data';
+
+h46 = uicontrol(...
+'Parent',h40,...
+'Units','normalized',...
+'BackgroundColor',[1 1 1],...
+'CData',[],...
+'Position',[0.349315068493151 0.266666666666667 0.513698630136986 0.121212121212121],...
+'String',{ 'sec '; 'ms' },...
+'Style','popupmenu',...
+'Value',1,...
+'Tag','edit_unit_data',...
+'UserData',[],...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'edit_format_data';
+
+h47 = uicontrol(...
+'Parent',h40,...
+'Units','normalized',...
+'BackgroundColor',[1 1 1],...
+'CData',[],...
+'Position',[0.349315068493151 0.454545454545455 0.547945205479452 0.121212121212121],...
+'String',{ 'R events'; 'IBIs' },...
+'Style','popupmenu',...
+'Value',1,...
+'Tag','edit_format_data',...
+'UserData',[],...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'edit_datavar_data';
+
+h48 = uicontrol(...
+'Parent',h40,...
+'Units','normalized',...
+'BackgroundColor',[1 1 1],...
+'CData',[],...
+'Position',[0.349315068493149 0.660606060606061 0.328767123287671 0.127272727272727],...
+'String',blanks(0),...
+'Style','edit',...
+'Value',[],...
+'Tag','edit_datavar_data',...
+'UserData',[],...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'push_ok_data';
+
+h49 = uicontrol(...
+'Parent',h40,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'Callback','importdata_callback',...
+'Position',[0.328767123287671 0.0545454545454545 0.424657534246575 0.145454545454545],...
+'String','ok',...
+'Tag','push_ok_data',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'panel_import_events';
+
+h50 = uipanel(...
+'Parent',h1,...
+'Title','Import Events',...
+'Tag','panel_import_events',...
+'UserData',[],...
+'Clipping','on',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'Position',[0.163528245787909 0.373913043478261 0.133795837462834 0.26231884057971],...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_latvar_events';
+
+h51 = uicontrol(...
+'Parent',h50,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'HorizontalAlignment','left',...
+'Position',[0.0236220472440945 0.691306058221873 0.543307086614173 0.0914634146341464],...
+'String','Latencies var',...
+'Style','text',...
+'Tag','txt_latvar_events',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_condvar_events';
+
+h52 = uicontrol(...
+'Parent',h50,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'HorizontalAlignment','left',...
+'Position',[0.0305343511450382 0.478787878787879 0.549618320610687 0.0909090909090909],...
+'String','Conditions var',...
+'Style','text',...
+'Tag','txt_condvar_events',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_unit_events';
+
+h53 = uicontrol(...
+'Parent',h50,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'HorizontalAlignment','left',...
+'Position',[0.0305343511450382 0.258064516129032 0.229007633587786 0.0967741935483871],...
+'String','Unit',...
+'Style','text',...
+'Tag','txt_unit_events',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'edit_latvar_events';
+
+h54 = uicontrol(...
+'Parent',h50,...
+'Units','normalized',...
+'BackgroundColor',[1 1 1],...
+'CData',[],...
+'Position',[0.595419847328244 0.666666666666667 0.381679389312977 0.127272727272727],...
+'String',blanks(0),...
+'Style','edit',...
+'Value',[],...
+'Tag','edit_latvar_events',...
+'UserData',[],...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'pop_unit_events';
+
+h55 = uicontrol(...
+'Parent',h50,...
+'Units','normalized',...
+'BackgroundColor',[1 1 1],...
+'Position',[0.595419847328244 0.245161290322581 0.351145038167939 0.12258064516129],...
+'String',{ 'sec'; 'ms' },...
+'Style','popupmenu',...
+'Value',1,...
+'Tag','pop_unit_events',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'edit_condvar_events';
+
+h56 = uicontrol(...
+'Parent',h50,...
+'Units','normalized',...
+'BackgroundColor',[1 1 1],...
+'CData',[],...
+'Position',[0.595419847328244 0.466666666666667 0.381679389312977 0.127272727272727],...
+'String',blanks(0),...
+'Style','edit',...
+'Value',[],...
+'Tag','edit_condvar_events',...
+'UserData',[],...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'push_ok_events';
+
+h57 = uicontrol(...
+'Parent',h50,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'Callback','importevents_callback',...
+'Position',[0.259842519685039 0.0487804878048781 0.488188976377953 0.146341463414634],...
+'String','ok',...
+'Tag','push_ok_events',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_subject_events';
+
+h58 = uicontrol(...
+'Parent',h50,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'HorizontalAlignment','left',...
+'Position',[0.0229007633587786 0.872727272727273 0.312977099236641 0.0909090909090909],...
+'String','Subject',...
+'Style','text',...
+'Tag','txt_subject_events',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'pop_subject_events';
+
+h59 = uicontrol(...
+'Parent',h50,...
+'Units','normalized',...
+'BackgroundColor',[1 1 1],...
+'CData',[],...
+'Position',[0.404580152671756 0.842424242424242 0.572519083969466 0.133333333333333],...
+'String',{ blanks(0); 'IBIs' },...
+'Style','popupmenu',...
+'Value',1,...
+'Tag','pop_subject_events',...
+'UserData',[],...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'panel_ECP';
+
+h60 = uipanel(...
+'Parent',h1,...
+'Title','Evoked Cardiac Potentials',...
+'Tag','panel_ECP',...
+'Clipping','on',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'Position',[0.0089197224975223 0.0130434782608696 0.288404360753221 0.347826086956522],...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'push_selectconds_ECP';
+
+h61 = uicontrol(...
+'Parent',h60,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'Callback','ECPselectevents_callback',...
+'Position',[0.0313588850174216 0.834821428571428 0.331010452961672 0.102678571428571],...
+'String','Select conditions',...
+'Tag','push_selectconds_ECP',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_epochstart_ECP';
+
+h62 = uicontrol(...
+'Parent',h60,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'CData',[],...
+'HorizontalAlignment','left',...
+'Position',[0.0323741007194245 0.710765098722417 0.233812949640288 0.0609756097560976],...
+'String','Epoch start',...
+'Style','text',...
+'Tag','txt_epochstart_ECP',...
+'UserData',[],...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'edit_epochend_ECP';
+
+h63 = uicontrol(...
+'Parent',h60,...
+'Units','normalized',...
+'BackgroundColor',[1 1 1],...
+'Position',[0.719424460431655 0.690439895470383 0.179856115107914 0.0934959349593497],...
+'String','1',...
+'Style','edit',...
+'Value',1,...
+'Tag','edit_epochend_ECP',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_epochend_ECP';
+
+h64 = uicontrol(...
+'Parent',h60,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'Position',[0.505030562016552 0.70786799646534 0.204828618308361 0.0646281240590184],...
+'String','Epoch end',...
+'Style','text',...
+'Tag','txt_epochend_ECP',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'edit_epochstart_ECP';
+
+h65 = uicontrol(...
+'Parent',h60,...
+'Units','normalized',...
+'BackgroundColor',[1 1 1],...
+'Position',[0.338129496402878 0.690439895470383 0.165467625899281 0.0934959349593497],...
+'String','1',...
+'Style','edit',...
+'Value',1,...
+'Tag','edit_epochstart_ECP',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_algorithm_ECP';
+
+h66 = uicontrol(...
+'Parent',h60,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'HorizontalAlignment','left',...
+'Position',[0.0313588850174216 0.558035714285714 0.212543554006969 0.0669642857142857],...
+'String','Algorithm',...
+'Style','text',...
+'Tag','txt_algorithm_ECP',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'pop_algorithm_ECP';
+
+h67 = uicontrol(...
+'Parent',h60,...
+'Units','normalized',...
+'BackgroundColor',[1 1 1],...
+'Position',[0.341807756802077 0.531957126245529 0.303402390869259 0.0917795844625113],...
+'String',{ 'mean'; 'CDR'; 'constant'; 'linear'; 'spline' },...
+'Style','popupmenu',...
+'Value',1,...
+'Tag','pop_algorithm_ECP',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_timewindow_ECP';
+
+h68 = uicontrol(...
+'Parent',h60,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'HorizontalAlignment','left',...
+'Position',[0.0323741007194245 0.397756968641115 0.262589928057554 0.0691056910569106],...
+'String','Time Window',...
+'Style','text',...
+'Tag','txt_timewindow_ECP',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'edit_timewindow_ECP';
+
+h69 = uicontrol(...
+'Parent',h60,...
+'Units','normalized',...
+'BackgroundColor',[1 1 1],...
+'Position',[0.341726618705036 0.401822009291522 0.161870503597122 0.0853658536585366],...
+'String','1',...
+'Style','edit',...
+'Value',1,...
+'Tag','edit_timewindow_ECP',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'check_removebsl_ECP';
+
+h70 = uicontrol(...
+'Parent',h60,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'Position',[0.0313588850174216 0.241071428571428 0.40418118466899 0.0669642857142857],...
+'String','Remove baseline',...
+'Style','checkbox',...
+'Value',1,...
+'Tag','check_removebsl_ECP',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'push_ok_ECP';
+
+h71 = uicontrol(...
+'Parent',h60,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'Callback','ECP_callback',...
+'Position',[0.379790940766551 0.0758928571428571 0.222996515679443 0.0982142857142857],...
+'String','ok',...
+'Tag','push_ok_ECP',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'panel_graphs';
+
+h72 = uipanel(...
+'Parent',h1,...
+'Title','Graphs',...
+'Tag','panel_graphs',...
+'Clipping','on',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'Position',[0.592666005946482 0.0115942028985507 0.397423191278494 0.972463768115942],...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'axes_IBIs';
+
+h73 = axes(...
+'Parent',h72,...
+'Position',[0.0705289672544081 0.738931297709924 0.458438287153652 0.23969465648855],...
+'CameraPosition',[0.5 0.5 9.16025403784439],...
+'CameraPositionMode',get(0,'defaultaxesCameraPositionMode'),...
+'Color',get(0,'defaultaxesColor'),...
+'ColorOrder',get(0,'defaultaxesColorOrder'),...
+'FontSize',8,...
+'LooseInset',[0.13569492144684 0.125485436893204 0.0991616733649981 0.0855582524271844],...
+'XColor',get(0,'defaultaxesXColor'),...
+'YColor',get(0,'defaultaxesYColor'),...
+'YLim',get(0,'defaultaxesYLim'),...
+'YLimMode','manual',...
+'ZColor',get(0,'defaultaxesZColor'),...
+'Tag','axes_IBIs',...
+'UserData',[],...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+h74 = get(h73,'title');
+
+set(h74,...
+'Parent',h73,...
+'Units','data',...
+'FontUnits','points',...
+'BackgroundColor','none',...
+'Color',[0 0 0],...
+'DisplayName',blanks(0),...
+'EdgeColor','none',...
+'EraseMode','normal',...
+'DVIMode','auto',...
+'FontAngle','normal',...
+'FontName','Helvetica',...
+'FontSize',10,...
+'FontWeight','normal',...
+'HorizontalAlignment','center',...
+'LineStyle','-',...
+'LineWidth',0.5,...
+'Margin',2,...
+'Position',[0.497252747252747 1.03503184713376 1.00005459937205],...
+'Rotation',0,...
+'String',blanks(0),...
+'Interpreter','tex',...
+'VerticalAlignment','bottom',...
+'ButtonDownFcn',[],...
+'CreateFcn', {@local_CreateFcn, [], ''} ,...
+'DeleteFcn',[],...
+'BusyAction','queue',...
+'HandleVisibility','off',...
+'HelpTopicKey',blanks(0),...
+'HitTest','on',...
+'Interruptible','on',...
+'SelectionHighlight','on',...
+'Serializable','on',...
+'Tag',blanks(0),...
+'UserData',[],...
+'Visible','on',...
+'XLimInclude','on',...
+'YLimInclude','on',...
+'ZLimInclude','on',...
+'CLimInclude','on',...
+'ALimInclude','on',...
+'IncludeRenderer','on',...
+'Clipping','off');
+
+h75 = get(h73,'xlabel');
+
+set(h75,...
+'Parent',h73,...
+'Units','data',...
+'FontUnits','points',...
+'BackgroundColor','none',...
+'Color',[0 0 0],...
+'DisplayName',blanks(0),...
+'EdgeColor','none',...
+'EraseMode','normal',...
+'DVIMode','auto',...
+'FontAngle','normal',...
+'FontName','Helvetica',...
+'FontSize',10,...
+'FontWeight','normal',...
+'HorizontalAlignment','center',...
+'LineStyle','-',...
+'LineWidth',0.5,...
+'Margin',2,...
+'Position',[0.497252747252747 -0.136942675159236 1.00005459937205],...
+'Rotation',0,...
+'String',blanks(0),...
+'Interpreter','tex',...
+'VerticalAlignment','cap',...
+'ButtonDownFcn',[],...
+'CreateFcn', {@local_CreateFcn, [], ''} ,...
+'DeleteFcn',[],...
+'BusyAction','queue',...
+'HandleVisibility','off',...
+'HelpTopicKey',blanks(0),...
+'HitTest','on',...
+'Interruptible','on',...
+'SelectionHighlight','on',...
+'Serializable','on',...
+'Tag',blanks(0),...
+'UserData',[],...
+'Visible','on',...
+'XLimInclude','on',...
+'YLimInclude','on',...
+'ZLimInclude','on',...
+'CLimInclude','on',...
+'ALimInclude','on',...
+'IncludeRenderer','on',...
+'Clipping','off');
+
+h76 = get(h73,'ylabel');
+
+set(h76,...
+'Parent',h73,...
+'Units','data',...
+'FontUnits','points',...
+'BackgroundColor','none',...
+'Color',[0 0 0],...
+'DisplayName',blanks(0),...
+'EdgeColor','none',...
+'EraseMode','normal',...
+'DVIMode','auto',...
+'FontAngle','normal',...
+'FontName','Helvetica',...
+'FontSize',10,...
+'FontWeight','normal',...
+'HorizontalAlignment','center',...
+'LineStyle','-',...
+'LineWidth',0.5,...
+'Margin',2,...
+'Position',[-0.14010989010989 0.493630573248408 1.00005459937205],...
+'Rotation',90,...
+'String',blanks(0),...
+'Interpreter','tex',...
+'VerticalAlignment','bottom',...
+'ButtonDownFcn',[],...
+'CreateFcn', {@local_CreateFcn, [], ''} ,...
+'DeleteFcn',[],...
+'BusyAction','queue',...
+'HandleVisibility','off',...
+'HelpTopicKey',blanks(0),...
+'HitTest','on',...
+'Interruptible','on',...
+'SelectionHighlight','on',...
+'Serializable','on',...
+'Tag',blanks(0),...
+'UserData',[],...
+'Visible','on',...
+'XLimInclude','on',...
+'YLimInclude','on',...
+'ZLimInclude','on',...
+'CLimInclude','on',...
+'ALimInclude','on',...
+'IncludeRenderer','on',...
+'Clipping','off');
+
+h77 = get(h73,'zlabel');
+
+set(h77,...
+'Parent',h73,...
+'Units','data',...
+'FontUnits','points',...
+'BackgroundColor','none',...
+'Color',[0 0 0],...
+'DisplayName',blanks(0),...
+'EdgeColor','none',...
+'EraseMode','normal',...
+'DVIMode','auto',...
+'FontAngle','normal',...
+'FontName','Helvetica',...
+'FontSize',10,...
+'FontWeight','normal',...
+'HorizontalAlignment','right',...
+'LineStyle','-',...
+'LineWidth',0.5,...
+'Margin',2,...
+'Position',[-3.4532967032967 1.23885350318471 1.00005459937205],...
+'Rotation',0,...
+'String',blanks(0),...
+'Interpreter','tex',...
+'VerticalAlignment','middle',...
+'ButtonDownFcn',[],...
+'CreateFcn', {@local_CreateFcn, [], ''} ,...
+'DeleteFcn',[],...
+'BusyAction','queue',...
+'HandleVisibility','off',...
+'HelpTopicKey',blanks(0),...
+'HitTest','on',...
+'Interruptible','on',...
+'SelectionHighlight','on',...
+'Serializable','on',...
+'Tag',blanks(0),...
+'UserData',[],...
+'Visible','off',...
+'XLimInclude','on',...
+'YLimInclude','on',...
+'ZLimInclude','on',...
+'CLimInclude','on',...
+'ALimInclude','on',...
+'IncludeRenderer','on',...
+'Clipping','off');
+
+appdata = [];
+appdata.lastValidTag = 'push_dwnsub_IBIs';
+
+h78 = uicontrol(...
+'Parent',h72,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'Callback','ibisubdwn_callback',...
+'Position',[0.551637279596978 0.933333333333333 0.052896725440806 0.0340740740740741],...
+'String','<',...
+'Tag','push_dwnsub_IBIs',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'push_ubsub_IBIs';
+
+h79 = uicontrol(...
+'Parent',h72,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'Callback','ibisubup_callback',...
+'Position',[0.614609571788413 0.933333333333333 0.052896725440806 0.0340740740740741],...
+'String','>',...
+'Tag','push_ubsub_IBIs',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'text55';
+
+h80 = uicontrol(...
+'Parent',h72,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'HorizontalAlignment','left',...
+'Position',[0.680100755667506 0.939259259259259 0.105793450881612 0.0222222222222222],...
+'String','Subject',...
+'Style','text',...
+'Tag','text55',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_info_IBIs';
+
+h81 = uicontrol(...
+'Parent',h72,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'HorizontalAlignment','left',...
+'Position',[0.554156171284635 0.746564885496183 0.430730478589421 0.125190839694657],...
+'String',{ 'Subjects :2'; 'Epochs: 5'; 'Codes: 10' },...
+'Style','text',...
+'Tag','txt_info_IBIs',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'axes_ECP';
+
+h82 = axes(...
+'Parent',h72,...
+'Position',[0.0705289672544081 0.40763358778626 0.458438287153652 0.23969465648855],...
+'CameraPosition',[0.5 0.5 9.16025403784439],...
+'CameraPositionMode',get(0,'defaultaxesCameraPositionMode'),...
+'Color',get(0,'defaultaxesColor'),...
+'ColorOrder',get(0,'defaultaxesColorOrder'),...
+'FontSize',8,...
+'LooseInset',[0.13569492144684 0.125485436893204 0.0991616733649981 0.0855582524271844],...
+'XColor',get(0,'defaultaxesXColor'),...
+'YColor',get(0,'defaultaxesYColor'),...
+'YLim',get(0,'defaultaxesYLim'),...
+'YLimMode','manual',...
+'ZColor',get(0,'defaultaxesZColor'),...
+'Tag','axes_ECP',...
+'UserData',[],...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+h83 = get(h82,'title');
+
+set(h83,...
+'Parent',h82,...
+'Units','data',...
+'FontUnits','points',...
+'BackgroundColor','none',...
+'Color',[0 0 0],...
+'DisplayName',blanks(0),...
+'EdgeColor','none',...
+'EraseMode','normal',...
+'DVIMode','auto',...
+'FontAngle','normal',...
+'FontName','Helvetica',...
+'FontSize',10,...
+'FontWeight','normal',...
+'HorizontalAlignment','center',...
+'LineStyle','-',...
+'LineWidth',0.5,...
+'Margin',2,...
+'Position',[0.497252747252747 1.03503184713376 1.00005459937205],...
+'Rotation',0,...
+'String',blanks(0),...
+'Interpreter','tex',...
+'VerticalAlignment','bottom',...
+'ButtonDownFcn',[],...
+'CreateFcn', {@local_CreateFcn, [], ''} ,...
+'DeleteFcn',[],...
+'BusyAction','queue',...
+'HandleVisibility','off',...
+'HelpTopicKey',blanks(0),...
+'HitTest','on',...
+'Interruptible','on',...
+'SelectionHighlight','on',...
+'Serializable','on',...
+'Tag',blanks(0),...
+'UserData',[],...
+'Visible','on',...
+'XLimInclude','on',...
+'YLimInclude','on',...
+'ZLimInclude','on',...
+'CLimInclude','on',...
+'ALimInclude','on',...
+'IncludeRenderer','on',...
+'Clipping','off');
+
+h84 = get(h82,'xlabel');
+
+set(h84,...
+'Parent',h82,...
+'Units','data',...
+'FontUnits','points',...
+'BackgroundColor','none',...
+'Color',[0 0 0],...
+'DisplayName',blanks(0),...
+'EdgeColor','none',...
+'EraseMode','normal',...
+'DVIMode','auto',...
+'FontAngle','normal',...
+'FontName','Helvetica',...
+'FontSize',10,...
+'FontWeight','normal',...
+'HorizontalAlignment','center',...
+'LineStyle','-',...
+'LineWidth',0.5,...
+'Margin',2,...
+'Position',[0.497252747252747 -0.136942675159236 1.00005459937205],...
+'Rotation',0,...
+'String',blanks(0),...
+'Interpreter','tex',...
+'VerticalAlignment','cap',...
+'ButtonDownFcn',[],...
+'CreateFcn', {@local_CreateFcn, [], ''} ,...
+'DeleteFcn',[],...
+'BusyAction','queue',...
+'HandleVisibility','off',...
+'HelpTopicKey',blanks(0),...
+'HitTest','on',...
+'Interruptible','on',...
+'SelectionHighlight','on',...
+'Serializable','on',...
+'Tag',blanks(0),...
+'UserData',[],...
+'Visible','on',...
+'XLimInclude','on',...
+'YLimInclude','on',...
+'ZLimInclude','on',...
+'CLimInclude','on',...
+'ALimInclude','on',...
+'IncludeRenderer','on',...
+'Clipping','off');
+
+h85 = get(h82,'ylabel');
+
+set(h85,...
+'Parent',h82,...
+'Units','data',...
+'FontUnits','points',...
+'BackgroundColor','none',...
+'Color',[0 0 0],...
+'DisplayName',blanks(0),...
+'EdgeColor','none',...
+'EraseMode','normal',...
+'DVIMode','auto',...
+'FontAngle','normal',...
+'FontName','Helvetica',...
+'FontSize',10,...
+'FontWeight','normal',...
+'HorizontalAlignment','center',...
+'LineStyle','-',...
+'LineWidth',0.5,...
+'Margin',2,...
+'Position',[-0.14010989010989 0.493630573248408 1.00005459937205],...
+'Rotation',90,...
+'String',blanks(0),...
+'Interpreter','tex',...
+'VerticalAlignment','bottom',...
+'ButtonDownFcn',[],...
+'CreateFcn', {@local_CreateFcn, [], ''} ,...
+'DeleteFcn',[],...
+'BusyAction','queue',...
+'HandleVisibility','off',...
+'HelpTopicKey',blanks(0),...
+'HitTest','on',...
+'Interruptible','on',...
+'SelectionHighlight','on',...
+'Serializable','on',...
+'Tag',blanks(0),...
+'UserData',[],...
+'Visible','on',...
+'XLimInclude','on',...
+'YLimInclude','on',...
+'ZLimInclude','on',...
+'CLimInclude','on',...
+'ALimInclude','on',...
+'IncludeRenderer','on',...
+'Clipping','off');
+
+h86 = get(h82,'zlabel');
+
+set(h86,...
+'Parent',h82,...
+'Units','data',...
+'FontUnits','points',...
+'BackgroundColor','none',...
+'Color',[0 0 0],...
+'DisplayName',blanks(0),...
+'EdgeColor','none',...
+'EraseMode','normal',...
+'DVIMode','auto',...
+'FontAngle','normal',...
+'FontName','Helvetica',...
+'FontSize',10,...
+'FontWeight','normal',...
+'HorizontalAlignment','right',...
+'LineStyle','-',...
+'LineWidth',0.5,...
+'Margin',2,...
+'Position',[-3.4532967032967 2.62101910828026 1.00005459937205],...
+'Rotation',0,...
+'String',blanks(0),...
+'Interpreter','tex',...
+'VerticalAlignment','middle',...
+'ButtonDownFcn',[],...
+'CreateFcn', {@local_CreateFcn, [], ''} ,...
+'DeleteFcn',[],...
+'BusyAction','queue',...
+'HandleVisibility','off',...
+'HelpTopicKey',blanks(0),...
+'HitTest','on',...
+'Interruptible','on',...
+'SelectionHighlight','on',...
+'Serializable','on',...
+'Tag',blanks(0),...
+'UserData',[],...
+'Visible','off',...
+'XLimInclude','on',...
+'YLimInclude','on',...
+'ZLimInclude','on',...
+'CLimInclude','on',...
+'ALimInclude','on',...
+'IncludeRenderer','on',...
+'Clipping','off');
+
+appdata = [];
+appdata.lastValidTag = 'axes_HRV';
+
+h87 = axes(...
+'Parent',h72,...
+'Position',[0.0705289672544081 0.0763358778625954 0.458438287153652 0.23969465648855],...
+'CameraPosition',[0.5 0.5 9.16025403784439],...
+'CameraPositionMode',get(0,'defaultaxesCameraPositionMode'),...
+'Color',get(0,'defaultaxesColor'),...
+'ColorOrder',get(0,'defaultaxesColorOrder'),...
+'FontSize',8,...
+'LooseInset',[0.13569492144684 0.125485436893204 0.0991616733649981 0.0855582524271844],...
+'XColor',get(0,'defaultaxesXColor'),...
+'YColor',get(0,'defaultaxesYColor'),...
+'YLim',get(0,'defaultaxesYLim'),...
+'YLimMode','manual',...
+'ZColor',get(0,'defaultaxesZColor'),...
+'Tag','axes_HRV',...
+'UserData',[],...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+h88 = get(h87,'title');
+
+set(h88,...
+'Parent',h87,...
+'Units','data',...
+'FontUnits','points',...
+'BackgroundColor','none',...
+'Color',[0 0 0],...
+'DisplayName',blanks(0),...
+'EdgeColor','none',...
+'EraseMode','normal',...
+'DVIMode','auto',...
+'FontAngle','normal',...
+'FontName','Helvetica',...
+'FontSize',10,...
+'FontWeight','normal',...
+'HorizontalAlignment','center',...
+'LineStyle','-',...
+'LineWidth',0.5,...
+'Margin',2,...
+'Position',[0.497252747252747 1.03503184713376 1.00005459937205],...
+'Rotation',0,...
+'String',blanks(0),...
+'Interpreter','tex',...
+'VerticalAlignment','bottom',...
+'ButtonDownFcn',[],...
+'CreateFcn', {@local_CreateFcn, [], ''} ,...
+'DeleteFcn',[],...
+'BusyAction','queue',...
+'HandleVisibility','off',...
+'HelpTopicKey',blanks(0),...
+'HitTest','on',...
+'Interruptible','on',...
+'SelectionHighlight','on',...
+'Serializable','on',...
+'Tag',blanks(0),...
+'UserData',[],...
+'Visible','on',...
+'XLimInclude','on',...
+'YLimInclude','on',...
+'ZLimInclude','on',...
+'CLimInclude','on',...
+'ALimInclude','on',...
+'IncludeRenderer','on',...
+'Clipping','off');
+
+h89 = get(h87,'xlabel');
+
+set(h89,...
+'Parent',h87,...
+'Units','data',...
+'FontUnits','points',...
+'BackgroundColor','none',...
+'Color',[0 0 0],...
+'DisplayName',blanks(0),...
+'EdgeColor','none',...
+'EraseMode','normal',...
+'DVIMode','auto',...
+'FontAngle','normal',...
+'FontName','Helvetica',...
+'FontSize',10,...
+'FontWeight','normal',...
+'HorizontalAlignment','center',...
+'LineStyle','-',...
+'LineWidth',0.5,...
+'Margin',2,...
+'Position',[0.497252747252747 -0.136942675159236 1.00005459937205],...
+'Rotation',0,...
+'String',blanks(0),...
+'Interpreter','tex',...
+'VerticalAlignment','cap',...
+'ButtonDownFcn',[],...
+'CreateFcn', {@local_CreateFcn, [], ''} ,...
+'DeleteFcn',[],...
+'BusyAction','queue',...
+'HandleVisibility','off',...
+'HelpTopicKey',blanks(0),...
+'HitTest','on',...
+'Interruptible','on',...
+'SelectionHighlight','on',...
+'Serializable','on',...
+'Tag',blanks(0),...
+'UserData',[],...
+'Visible','on',...
+'XLimInclude','on',...
+'YLimInclude','on',...
+'ZLimInclude','on',...
+'CLimInclude','on',...
+'ALimInclude','on',...
+'IncludeRenderer','on',...
+'Clipping','off');
+
+h90 = get(h87,'ylabel');
+
+set(h90,...
+'Parent',h87,...
+'Units','data',...
+'FontUnits','points',...
+'BackgroundColor','none',...
+'Color',[0 0 0],...
+'DisplayName',blanks(0),...
+'EdgeColor','none',...
+'EraseMode','normal',...
+'DVIMode','auto',...
+'FontAngle','normal',...
+'FontName','Helvetica',...
+'FontSize',10,...
+'FontWeight','normal',...
+'HorizontalAlignment','center',...
+'LineStyle','-',...
+'LineWidth',0.5,...
+'Margin',2,...
+'Position',[-0.14010989010989 0.493630573248407 1.00005459937205],...
+'Rotation',90,...
+'String',blanks(0),...
+'Interpreter','tex',...
+'VerticalAlignment','bottom',...
+'ButtonDownFcn',[],...
+'CreateFcn', {@local_CreateFcn, [], ''} ,...
+'DeleteFcn',[],...
+'BusyAction','queue',...
+'HandleVisibility','off',...
+'HelpTopicKey',blanks(0),...
+'HitTest','on',...
+'Interruptible','on',...
+'SelectionHighlight','on',...
+'Serializable','on',...
+'Tag',blanks(0),...
+'UserData',[],...
+'Visible','on',...
+'XLimInclude','on',...
+'YLimInclude','on',...
+'ZLimInclude','on',...
+'CLimInclude','on',...
+'ALimInclude','on',...
+'IncludeRenderer','on',...
+'Clipping','off');
+
+h91 = get(h87,'zlabel');
+
+set(h91,...
+'Parent',h87,...
+'Units','data',...
+'FontUnits','points',...
+'BackgroundColor','none',...
+'Color',[0 0 0],...
+'DisplayName',blanks(0),...
+'EdgeColor','none',...
+'EraseMode','normal',...
+'DVIMode','auto',...
+'FontAngle','normal',...
+'FontName','Helvetica',...
+'FontSize',10,...
+'FontWeight','normal',...
+'HorizontalAlignment','right',...
+'LineStyle','-',...
+'LineWidth',0.5,...
+'Margin',2,...
+'Position',[-3.4532967032967 4.0031847133758 1.00005459937205],...
+'Rotation',0,...
+'String',blanks(0),...
+'Interpreter','tex',...
+'VerticalAlignment','middle',...
+'ButtonDownFcn',[],...
+'CreateFcn', {@local_CreateFcn, [], ''} ,...
+'DeleteFcn',[],...
+'BusyAction','queue',...
+'HandleVisibility','off',...
+'HelpTopicKey',blanks(0),...
+'HitTest','on',...
+'Interruptible','on',...
+'SelectionHighlight','on',...
+'Serializable','on',...
+'Tag',blanks(0),...
+'UserData',[],...
+'Visible','off',...
+'XLimInclude','on',...
+'YLimInclude','on',...
+'ZLimInclude','on',...
+'CLimInclude','on',...
+'ALimInclude','on',...
+'IncludeRenderer','on',...
+'Clipping','off');
+
+appdata = [];
+appdata.lastValidTag = 'push_dwnsub_ECP';
+
+h92 = uicontrol(...
+'Parent',h72,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'Callback','ECPsubdwn_callback',...
+'Position',[0.54911838790932 0.613333333333334 0.052896725440806 0.0340740740740741],...
+'String','<',...
+'Tag','push_dwnsub_ECP',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'push_upsub_ECP';
+
+h93 = uicontrol(...
+'Parent',h72,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'Callback','ECPsubup_callback',...
+'Position',[0.612090680100756 0.613333333333334 0.052896725440806 0.0340740740740741],...
+'String','>',...
+'Tag','push_upsub_ECP',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_subject_ECP';
+
+h94 = uicontrol(...
+'Parent',h72,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'HorizontalAlignment','left',...
+'Position',[0.677581863979849 0.61925925925926 0.100755667506297 0.0222222222222222],...
+'String','Subject',...
+'Style','text',...
+'Tag','txt_subject_ECP',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_info1_HRV';
+
+h95 = uicontrol(...
+'Parent',h72,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'HorizontalAlignment','left',...
+'Position',[0.541561712846348 0.0412213740458015 0.269521410579345 0.141984732824427],...
+'String',{ 'Epochs: 5'; 'Codes: 10'; 'Reject Artifacts: YES'; 'mean IBI: 1.2'; 'max IBI: 1.2'; 'min IBI: 0.4' },...
+'Style','text',...
+'Tag','txt_info1_HRV',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'push_dwnepoch_HRV';
+
+h96 = uicontrol(...
+'Parent',h72,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'Callback','HRVepochdwn_callback',...
+'Position',[0.54911838790932 0.2 0.052896725440806 0.033587786259542],...
+'String','<',...
+'Tag','push_dwnepoch_HRV',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'push_upepoch_HRV';
+
+h97 = uicontrol(...
+'Parent',h72,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'Callback','HRVepochup_callback',...
+'Position',[0.612090680100756 0.2 0.052896725440806 0.033587786259542],...
+'String','>',...
+'Tag','push_upepoch_HRV',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_epoh_HRV';
+
+h98 = uicontrol(...
+'Parent',h72,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'HorizontalAlignment','left',...
+'Position',[0.677581863979849 0.204580152671756 0.0957178841309824 0.0229007633587786],...
+'String','Epoch',...
+'Style','text',...
+'Tag','txt_epoh_HRV',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'push_dwnsub_HRV';
+
+h99 = uicontrol(...
+'Parent',h72,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'Callback','HRVsubdwn_callback',...
+'Position',[0.54911838790932 0.288549618320611 0.052896725440806 0.033587786259542],...
+'String','<',...
+'Tag','push_dwnsub_HRV',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'push_upsub_HRV';
+
+h100 = uicontrol(...
+'Parent',h72,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'Callback','HRVsubup_callback',...
+'Position',[0.612090680100756 0.288549618320611 0.052896725440806 0.033587786259542],...
+'String','>',...
+'Tag','push_upsub_HRV',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_subject_HRV';
+
+h101 = uicontrol(...
+'Parent',h72,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'HorizontalAlignment','left',...
+'Position',[0.677581863979849 0.295176703420978 0.100755667506297 0.0222222222222222],...
+'String','Subject',...
+'Style','text',...
+'Tag','txt_subject_HRV',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_info2_HRV';
+
+h102 = uicontrol(...
+'Parent',h72,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'HorizontalAlignment','left',...
+'Position',[0.828715365239295 0.0702290076335878 0.161209068010076 0.114503816793893],...
+'String',{ 'HF: 345 '; 'LF: 8734'; 'VLF: 678'; 'alpha: 0.5' },...
+'Style','text',...
+'Tag','txt_info2_HRV',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'edit_subject_IBIs';
+
+h103 = uicontrol(...
+'Parent',h72,...
+'Units','normalized',...
+'BackgroundColor',[1 1 1],...
+'Position',[0.586901763224181 0.890076335877863 0.329974811083123 0.0320610687022901],...
+'String',blanks(0),...
+'Style','edit',...
+'Tag','edit_subject_IBIs',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'edit_subject_ECP';
+
+h104 = uicontrol(...
+'Parent',h72,...
+'Units','normalized',...
+'BackgroundColor',[1 1 1],...
+'Position',[0.586901763224181 0.566412213740458 0.329974811083123 0.0320610687022901],...
+'String',blanks(0),...
+'Style','edit',...
+'Tag','edit_subject_ECP',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'edit_subject_HRV';
+
+h105 = uicontrol(...
+'Parent',h72,...
+'Units','normalized',...
+'BackgroundColor',[1 1 1],...
+'Position',[0.586901763224181 0.247328244274809 0.329974811083123 0.0320610687022901],...
+'String',blanks(0),...
+'Style','edit',...
+'Tag','edit_subject_HRV',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'edit_epoch_HRV';
+
+h106 = uicontrol(...
+'Parent',h72,...
+'Units','normalized',...
+'BackgroundColor',[1 1 1],...
+'Position',[0.775818639798489 0.2 0.123425692695214 0.0320610687022901],...
+'String',blanks(0),...
+'Style','edit',...
+'Tag','edit_epoch_HRV',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'txt_info_ECP';
+
+h107 = uicontrol(...
+'Parent',h72,...
+'Units','normalized',...
+'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+'HorizontalAlignment','left',...
+'Position',[0.554156171284635 0.416793893129771 0.430730478589421 0.125190839694657],...
+'String',{ 'Subjects :2'; 'Epochs: 5'; 'Codes: 10' },...
+'Style','text',...
+'Tag','txt_info_ECP',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.lastValidTag = 'uitoolbar1';
+
+h108 = uitoolbar(...
+'Parent',h1,...
+'Tag','uitoolbar1',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.toolid = 'Standard.SaveFigure';
+appdata.CallbackInUse = struct(...
+ 'ClickedCallback', 'save_callback');
+appdata.lastValidTag = 'toolsave';
+
+h109 = uipushtool(...
+'Parent',h108,...
+'ClickedCallback','save_callback',...
+'CData',mat{1},...
+'TooltipString','Save Data',...
+'BusyAction','cancel',...
+'Interruptible','off',...
+'Tag','toolsave',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.toolid = 'Standard.PrintFigure';
+appdata.CallbackInUse = struct(...
+ 'ClickedCallback', 'export_callback');
+appdata.lastValidTag = 'toolexcel';
+
+h110 = uipushtool(...
+'Parent',h108,...
+'ClickedCallback','export_callback',...
+'CData',mat{2},...
+'TooltipString','Export to Excel',...
+'BusyAction','cancel',...
+'Interruptible','off',...
+'Tag','toolexcel',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.toolid = [];
+appdata.lastValidTag = 'tooltutorial';
+
+h111 = uitoggletool(...
+'Parent',h108,...
+'ClickedCallback','tutorial_callback',...
+'CData',mat{3},...
+'TooltipString','KARDIA User''s Guide',...
+'Tag','tooltutorial',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+appdata = [];
+appdata.toolid = [];
+appdata.lastValidTag = 'toolabout';
+
+h112 = uipushtool(...
+'Parent',h108,...
+'ClickedCallback','about_callback',...
+'CData',mat{4},...
+'TooltipString','About',...
+'Tag','toolabout',...
+'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
+
+
+
+% --- Set application data first then calling the CreateFcn.
+function local_CreateFcn(hObject, eventdata, createfcn, appdata)
+
+if ~isempty(appdata)
+ names = fieldnames(appdata);
+ for i=1:length(names)
+ name = char(names(i));
+ setappdata(hObject, name, getfield(appdata,name));
+ end
+end
+
+if ~isempty(createfcn)
+ eval(createfcn);
+end
diff --git a/Documentation/._GNU Free Documentation License.txt b/Documentation/._GNU Free Documentation License.txt
new file mode 100644
index 0000000..32f87f2
Binary files /dev/null and b/Documentation/._GNU Free Documentation License.txt differ
diff --git a/Documentation/._GNU General Public License.txt b/Documentation/._GNU General Public License.txt
new file mode 100644
index 0000000..46f3a6f
Binary files /dev/null and b/Documentation/._GNU General Public License.txt differ
diff --git a/Documentation/._User's Guide.pdf b/Documentation/._User's Guide.pdf
new file mode 100644
index 0000000..8b8cb46
Binary files /dev/null and b/Documentation/._User's Guide.pdf differ
diff --git a/Documentation/GNU Free Documentation License.txt b/Documentation/GNU Free Documentation License.txt
new file mode 100644
index 0000000..4a0fe1c
--- /dev/null
+++ b/Documentation/GNU Free Documentation License.txt
@@ -0,0 +1,397 @@
+ GNU Free Documentation License
+ Version 1.2, November 2002
+
+
+ Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+0. PREAMBLE
+
+The purpose of this License is to make a manual, textbook, or other
+functional and useful document "free" in the sense of freedom: to
+assure everyone the effective freedom to copy and redistribute it,
+with or without modifying it, either commercially or noncommercially.
+Secondarily, this License preserves for the author and publisher a way
+to get credit for their work, while not being considered responsible
+for modifications made by others.
+
+This License is a kind of "copyleft", which means that derivative
+works of the document must themselves be free in the same sense. It
+complements the GNU General Public License, which is a copyleft
+license designed for free software.
+
+We have designed this License in order to use it for manuals for free
+software, because free software needs free documentation: a free
+program should come with manuals providing the same freedoms that the
+software does. But this License is not limited to software manuals;
+it can be used for any textual work, regardless of subject matter or
+whether it is published as a printed book. We recommend this License
+principally for works whose purpose is instruction or reference.
+
+
+1. APPLICABILITY AND DEFINITIONS
+
+This License applies to any manual or other work, in any medium, that
+contains a notice placed by the copyright holder saying it can be
+distributed under the terms of this License. Such a notice grants a
+world-wide, royalty-free license, unlimited in duration, to use that
+work under the conditions stated herein. The "Document", below,
+refers to any such manual or work. Any member of the public is a
+licensee, and is addressed as "you". You accept the license if you
+copy, modify or distribute the work in a way requiring permission
+under copyright law.
+
+A "Modified Version" of the Document means any work containing the
+Document or a portion of it, either copied verbatim, or with
+modifications and/or translated into another language.
+
+A "Secondary Section" is a named appendix or a front-matter section of
+the Document that deals exclusively with the relationship of the
+publishers or authors of the Document to the Document's overall subject
+(or to related matters) and contains nothing that could fall directly
+within that overall subject. (Thus, if the Document is in part a
+textbook of mathematics, a Secondary Section may not explain any
+mathematics.) The relationship could be a matter of historical
+connection with the subject or with related matters, or of legal,
+commercial, philosophical, ethical or political position regarding
+them.
+
+The "Invariant Sections" are certain Secondary Sections whose titles
+are designated, as being those of Invariant Sections, in the notice
+that says that the Document is released under this License. If a
+section does not fit the above definition of Secondary then it is not
+allowed to be designated as Invariant. The Document may contain zero
+Invariant Sections. If the Document does not identify any Invariant
+Sections then there are none.
+
+The "Cover Texts" are certain short passages of text that are listed,
+as Front-Cover Texts or Back-Cover Texts, in the notice that says that
+the Document is released under this License. A Front-Cover Text may
+be at most 5 words, and a Back-Cover Text may be at most 25 words.
+
+A "Transparent" copy of the Document means a machine-readable copy,
+represented in a format whose specification is available to the
+general public, that is suitable for revising the document
+straightforwardly with generic text editors or (for images composed of
+pixels) generic paint programs or (for drawings) some widely available
+drawing editor, and that is suitable for input to text formatters or
+for automatic translation to a variety of formats suitable for input
+to text formatters. A copy made in an otherwise Transparent file
+format whose markup, or absence of markup, has been arranged to thwart
+or discourage subsequent modification by readers is not Transparent.
+An image format is not Transparent if used for any substantial amount
+of text. A copy that is not "Transparent" is called "Opaque".
+
+Examples of suitable formats for Transparent copies include plain
+ASCII without markup, Texinfo input format, LaTeX input format, SGML
+or XML using a publicly available DTD, and standard-conforming simple
+HTML, PostScript or PDF designed for human modification. Examples of
+transparent image formats include PNG, XCF and JPG. Opaque formats
+include proprietary formats that can be read and edited only by
+proprietary word processors, SGML or XML for which the DTD and/or
+processing tools are not generally available, and the
+machine-generated HTML, PostScript or PDF produced by some word
+processors for output purposes only.
+
+The "Title Page" means, for a printed book, the title page itself,
+plus such following pages as are needed to hold, legibly, the material
+this License requires to appear in the title page. For works in
+formats which do not have any title page as such, "Title Page" means
+the text near the most prominent appearance of the work's title,
+preceding the beginning of the body of the text.
+
+A section "Entitled XYZ" means a named subunit of the Document whose
+title either is precisely XYZ or contains XYZ in parentheses following
+text that translates XYZ in another language. (Here XYZ stands for a
+specific section name mentioned below, such as "Acknowledgements",
+"Dedications", "Endorsements", or "History".) To "Preserve the Title"
+of such a section when you modify the Document means that it remains a
+section "Entitled XYZ" according to this definition.
+
+The Document may include Warranty Disclaimers next to the notice which
+states that this License applies to the Document. These Warranty
+Disclaimers are considered to be included by reference in this
+License, but only as regards disclaiming warranties: any other
+implication that these Warranty Disclaimers may have is void and has
+no effect on the meaning of this License.
+
+
+2. VERBATIM COPYING
+
+You may copy and distribute the Document in any medium, either
+commercially or noncommercially, provided that this License, the
+copyright notices, and the license notice saying this License applies
+to the Document are reproduced in all copies, and that you add no other
+conditions whatsoever to those of this License. You may not use
+technical measures to obstruct or control the reading or further
+copying of the copies you make or distribute. However, you may accept
+compensation in exchange for copies. If you distribute a large enough
+number of copies you must also follow the conditions in section 3.
+
+You may also lend copies, under the same conditions stated above, and
+you may publicly display copies.
+
+
+3. COPYING IN QUANTITY
+
+If you publish printed copies (or copies in media that commonly have
+printed covers) of the Document, numbering more than 100, and the
+Document's license notice requires Cover Texts, you must enclose the
+copies in covers that carry, clearly and legibly, all these Cover
+Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
+the back cover. Both covers must also clearly and legibly identify
+you as the publisher of these copies. The front cover must present
+the full title with all words of the title equally prominent and
+visible. You may add other material on the covers in addition.
+Copying with changes limited to the covers, as long as they preserve
+the title of the Document and satisfy these conditions, can be treated
+as verbatim copying in other respects.
+
+If the required texts for either cover are too voluminous to fit
+legibly, you should put the first ones listed (as many as fit
+reasonably) on the actual cover, and continue the rest onto adjacent
+pages.
+
+If you publish or distribute Opaque copies of the Document numbering
+more than 100, you must either include a machine-readable Transparent
+copy along with each Opaque copy, or state in or with each Opaque copy
+a computer-network location from which the general network-using
+public has access to download using public-standard network protocols
+a complete Transparent copy of the Document, free of added material.
+If you use the latter option, you must take reasonably prudent steps,
+when you begin distribution of Opaque copies in quantity, to ensure
+that this Transparent copy will remain thus accessible at the stated
+location until at least one year after the last time you distribute an
+Opaque copy (directly or through your agents or retailers) of that
+edition to the public.
+
+It is requested, but not required, that you contact the authors of the
+Document well before redistributing any large number of copies, to give
+them a chance to provide you with an updated version of the Document.
+
+
+4. MODIFICATIONS
+
+You may copy and distribute a Modified Version of the Document under
+the conditions of sections 2 and 3 above, provided that you release
+the Modified Version under precisely this License, with the Modified
+Version filling the role of the Document, thus licensing distribution
+and modification of the Modified Version to whoever possesses a copy
+of it. In addition, you must do these things in the Modified Version:
+
+A. Use in the Title Page (and on the covers, if any) a title distinct
+ from that of the Document, and from those of previous versions
+ (which should, if there were any, be listed in the History section
+ of the Document). You may use the same title as a previous version
+ if the original publisher of that version gives permission.
+B. List on the Title Page, as authors, one or more persons or entities
+ responsible for authorship of the modifications in the Modified
+ Version, together with at least five of the principal authors of the
+ Document (all of its principal authors, if it has fewer than five),
+ unless they release you from this requirement.
+C. State on the Title page the name of the publisher of the
+ Modified Version, as the publisher.
+D. Preserve all the copyright notices of the Document.
+E. Add an appropriate copyright notice for your modifications
+ adjacent to the other copyright notices.
+F. Include, immediately after the copyright notices, a license notice
+ giving the public permission to use the Modified Version under the
+ terms of this License, in the form shown in the Addendum below.
+G. Preserve in that license notice the full lists of Invariant Sections
+ and required Cover Texts given in the Document's license notice.
+H. Include an unaltered copy of this License.
+I. Preserve the section Entitled "History", Preserve its Title, and add
+ to it an item stating at least the title, year, new authors, and
+ publisher of the Modified Version as given on the Title Page. If
+ there is no section Entitled "History" in the Document, create one
+ stating the title, year, authors, and publisher of the Document as
+ given on its Title Page, then add an item describing the Modified
+ Version as stated in the previous sentence.
+J. Preserve the network location, if any, given in the Document for
+ public access to a Transparent copy of the Document, and likewise
+ the network locations given in the Document for previous versions
+ it was based on. These may be placed in the "History" section.
+ You may omit a network location for a work that was published at
+ least four years before the Document itself, or if the original
+ publisher of the version it refers to gives permission.
+K. For any section Entitled "Acknowledgements" or "Dedications",
+ Preserve the Title of the section, and preserve in the section all
+ the substance and tone of each of the contributor acknowledgements
+ and/or dedications given therein.
+L. Preserve all the Invariant Sections of the Document,
+ unaltered in their text and in their titles. Section numbers
+ or the equivalent are not considered part of the section titles.
+M. Delete any section Entitled "Endorsements". Such a section
+ may not be included in the Modified Version.
+N. Do not retitle any existing section to be Entitled "Endorsements"
+ or to conflict in title with any Invariant Section.
+O. Preserve any Warranty Disclaimers.
+
+If the Modified Version includes new front-matter sections or
+appendices that qualify as Secondary Sections and contain no material
+copied from the Document, you may at your option designate some or all
+of these sections as invariant. To do this, add their titles to the
+list of Invariant Sections in the Modified Version's license notice.
+These titles must be distinct from any other section titles.
+
+You may add a section Entitled "Endorsements", provided it contains
+nothing but endorsements of your Modified Version by various
+parties--for example, statements of peer review or that the text has
+been approved by an organization as the authoritative definition of a
+standard.
+
+You may add a passage of up to five words as a Front-Cover Text, and a
+passage of up to 25 words as a Back-Cover Text, to the end of the list
+of Cover Texts in the Modified Version. Only one passage of
+Front-Cover Text and one of Back-Cover Text may be added by (or
+through arrangements made by) any one entity. If the Document already
+includes a cover text for the same cover, previously added by you or
+by arrangement made by the same entity you are acting on behalf of,
+you may not add another; but you may replace the old one, on explicit
+permission from the previous publisher that added the old one.
+
+The author(s) and publisher(s) of the Document do not by this License
+give permission to use their names for publicity for or to assert or
+imply endorsement of any Modified Version.
+
+
+5. COMBINING DOCUMENTS
+
+You may combine the Document with other documents released under this
+License, under the terms defined in section 4 above for modified
+versions, provided that you include in the combination all of the
+Invariant Sections of all of the original documents, unmodified, and
+list them all as Invariant Sections of your combined work in its
+license notice, and that you preserve all their Warranty Disclaimers.
+
+The combined work need only contain one copy of this License, and
+multiple identical Invariant Sections may be replaced with a single
+copy. If there are multiple Invariant Sections with the same name but
+different contents, make the title of each such section unique by
+adding at the end of it, in parentheses, the name of the original
+author or publisher of that section if known, or else a unique number.
+Make the same adjustment to the section titles in the list of
+Invariant Sections in the license notice of the combined work.
+
+In the combination, you must combine any sections Entitled "History"
+in the various original documents, forming one section Entitled
+"History"; likewise combine any sections Entitled "Acknowledgements",
+and any sections Entitled "Dedications". You must delete all sections
+Entitled "Endorsements".
+
+
+6. COLLECTIONS OF DOCUMENTS
+
+You may make a collection consisting of the Document and other documents
+released under this License, and replace the individual copies of this
+License in the various documents with a single copy that is included in
+the collection, provided that you follow the rules of this License for
+verbatim copying of each of the documents in all other respects.
+
+You may extract a single document from such a collection, and distribute
+it individually under this License, provided you insert a copy of this
+License into the extracted document, and follow this License in all
+other respects regarding verbatim copying of that document.
+
+
+7. AGGREGATION WITH INDEPENDENT WORKS
+
+A compilation of the Document or its derivatives with other separate
+and independent documents or works, in or on a volume of a storage or
+distribution medium, is called an "aggregate" if the copyright
+resulting from the compilation is not used to limit the legal rights
+of the compilation's users beyond what the individual works permit.
+When the Document is included in an aggregate, this License does not
+apply to the other works in the aggregate which are not themselves
+derivative works of the Document.
+
+If the Cover Text requirement of section 3 is applicable to these
+copies of the Document, then if the Document is less than one half of
+the entire aggregate, the Document's Cover Texts may be placed on
+covers that bracket the Document within the aggregate, or the
+electronic equivalent of covers if the Document is in electronic form.
+Otherwise they must appear on printed covers that bracket the whole
+aggregate.
+
+
+8. TRANSLATION
+
+Translation is considered a kind of modification, so you may
+distribute translations of the Document under the terms of section 4.
+Replacing Invariant Sections with translations requires special
+permission from their copyright holders, but you may include
+translations of some or all Invariant Sections in addition to the
+original versions of these Invariant Sections. You may include a
+translation of this License, and all the license notices in the
+Document, and any Warranty Disclaimers, provided that you also include
+the original English version of this License and the original versions
+of those notices and disclaimers. In case of a disagreement between
+the translation and the original version of this License or a notice
+or disclaimer, the original version will prevail.
+
+If a section in the Document is Entitled "Acknowledgements",
+"Dedications", or "History", the requirement (section 4) to Preserve
+its Title (section 1) will typically require changing the actual
+title.
+
+
+9. TERMINATION
+
+You may not copy, modify, sublicense, or distribute the Document except
+as expressly provided for under this License. Any other attempt to
+copy, modify, sublicense or distribute the Document is void, and will
+automatically terminate your rights under this License. However,
+parties who have received copies, or rights, from you under this
+License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+
+10. FUTURE REVISIONS OF THIS LICENSE
+
+The Free Software Foundation may publish new, revised versions
+of the GNU Free Documentation License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns. See
+http://www.gnu.org/copyleft/.
+
+Each version of the License is given a distinguishing version number.
+If the Document specifies that a particular numbered version of this
+License "or any later version" applies to it, you have the option of
+following the terms and conditions either of that specified version or
+of any later version that has been published (not as a draft) by the
+Free Software Foundation. If the Document does not specify a version
+number of this License, you may choose any version ever published (not
+as a draft) by the Free Software Foundation.
+
+
+ADDENDUM: How to use this License for your documents
+
+To use this License in a document you have written, include a copy of
+the License in the document and put the following copyright and
+license notices just after the title page:
+
+ Copyright (c) YEAR YOUR NAME.
+ Permission is granted to copy, distribute and/or modify this document
+ under the terms of the GNU Free Documentation License, Version 1.2
+ or any later version published by the Free Software Foundation;
+ with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
+ A copy of the license is included in the section entitled "GNU
+ Free Documentation License".
+
+If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
+replace the "with...Texts." line with this:
+
+ with the Invariant Sections being LIST THEIR TITLES, with the
+ Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
+
+If you have Invariant Sections without Cover Texts, or some other
+combination of the three, merge those two alternatives to suit the
+situation.
+
+If your document contains nontrivial examples of program code, we
+recommend releasing these examples in parallel under your choice of
+free software license, such as the GNU General Public License,
+to permit their use in free software.
diff --git a/Documentation/GNU General Public License.txt b/Documentation/GNU General Public License.txt
new file mode 100644
index 0000000..94a9ed0
--- /dev/null
+++ b/Documentation/GNU General Public License.txt
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program 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.
+
+ This program 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 this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/Documentation/User's Guide.pdf b/Documentation/User's Guide.pdf
new file mode 100644
index 0000000..13b4084
Binary files /dev/null and b/Documentation/User's Guide.pdf differ
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..61d1860
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,674 @@
+GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program 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.
+
+ This program 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 this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
\ No newline at end of file
diff --git a/Plugins/xlwrite/._Test_xlWrite.m b/Plugins/xlwrite/._Test_xlWrite.m
new file mode 100644
index 0000000..46f3a6f
Binary files /dev/null and b/Plugins/xlwrite/._Test_xlWrite.m differ
diff --git a/Plugins/xlwrite/._license.txt b/Plugins/xlwrite/._license.txt
new file mode 100644
index 0000000..46f3a6f
Binary files /dev/null and b/Plugins/xlwrite/._license.txt differ
diff --git a/Plugins/xlwrite/._xlwrite.m b/Plugins/xlwrite/._xlwrite.m
new file mode 100644
index 0000000..46f3a6f
Binary files /dev/null and b/Plugins/xlwrite/._xlwrite.m differ
diff --git a/Plugins/xlwrite/Test_xlWrite.m b/Plugins/xlwrite/Test_xlWrite.m
new file mode 100644
index 0000000..6097c27
--- /dev/null
+++ b/Plugins/xlwrite/Test_xlWrite.m
@@ -0,0 +1,28 @@
+%% Small demonstration on how to use XLWRITE
+
+%% Initialisation of POI Libs
+% Add Java POI Libs to matlab javapath
+javaaddpath('poi_library/poi-3.8-20120326.jar');
+javaaddpath('poi_library/poi-ooxml-3.8-20120326.jar');
+javaaddpath('poi_library/poi-ooxml-schemas-3.8-20120326.jar');
+javaaddpath('poi_library/xmlbeans-2.3.0.jar');
+javaaddpath('poi_library/dom4j-1.6.1.jar');
+javaaddpath('poi_library/stax-api-1.0.1.jar');
+
+%% Data Generation for XLSX
+% Define an xls name
+fileName = 'test_xlwrite.xlsx';
+sheetName = 'this_is_sheetname';
+startRange = 'B3';
+
+% Generate some data
+xlsData = {'A Number' 'Boolean Data' 'Empty Cells' 'Strings';...
+ 1 true [] 'String Text';...
+ 5 false [] 'Another very descriptive text';...
+ -6.26 false 'This should have been an empty cell but I made an error' 'This is text';...
+ 1e8 true [] 'Last cell with text';...
+ 1e3 false NaN NaN;...
+ 1e2 true [] 'test'}
+
+%% Generate XLSX file
+xlwrite(fileName, xlsData, sheetName, startRange);
\ No newline at end of file
diff --git a/Plugins/xlwrite/license.txt b/Plugins/xlwrite/license.txt
new file mode 100644
index 0000000..43b359f
--- /dev/null
+++ b/Plugins/xlwrite/license.txt
@@ -0,0 +1,24 @@
+Copyright (c) 2013, Alec de Zegher
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the distribution
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/Plugins/xlwrite/poi_library/._LICENSE b/Plugins/xlwrite/poi_library/._LICENSE
new file mode 100644
index 0000000..46f3a6f
Binary files /dev/null and b/Plugins/xlwrite/poi_library/._LICENSE differ
diff --git a/Plugins/xlwrite/poi_library/._dom4j-1.6.1.jar b/Plugins/xlwrite/poi_library/._dom4j-1.6.1.jar
new file mode 100644
index 0000000..46f3a6f
Binary files /dev/null and b/Plugins/xlwrite/poi_library/._dom4j-1.6.1.jar differ
diff --git a/Plugins/xlwrite/poi_library/._poi-3.8-20120326.jar b/Plugins/xlwrite/poi_library/._poi-3.8-20120326.jar
new file mode 100644
index 0000000..46f3a6f
Binary files /dev/null and b/Plugins/xlwrite/poi_library/._poi-3.8-20120326.jar differ
diff --git a/Plugins/xlwrite/poi_library/._poi-ooxml-3.8-20120326.jar b/Plugins/xlwrite/poi_library/._poi-ooxml-3.8-20120326.jar
new file mode 100644
index 0000000..46f3a6f
Binary files /dev/null and b/Plugins/xlwrite/poi_library/._poi-ooxml-3.8-20120326.jar differ
diff --git a/Plugins/xlwrite/poi_library/._poi-ooxml-schemas-3.8-20120326.jar b/Plugins/xlwrite/poi_library/._poi-ooxml-schemas-3.8-20120326.jar
new file mode 100644
index 0000000..46f3a6f
Binary files /dev/null and b/Plugins/xlwrite/poi_library/._poi-ooxml-schemas-3.8-20120326.jar differ
diff --git a/Plugins/xlwrite/poi_library/._stax-api-1.0.1.jar b/Plugins/xlwrite/poi_library/._stax-api-1.0.1.jar
new file mode 100644
index 0000000..46f3a6f
Binary files /dev/null and b/Plugins/xlwrite/poi_library/._stax-api-1.0.1.jar differ
diff --git a/Plugins/xlwrite/poi_library/._xmlbeans-2.3.0.jar b/Plugins/xlwrite/poi_library/._xmlbeans-2.3.0.jar
new file mode 100644
index 0000000..46f3a6f
Binary files /dev/null and b/Plugins/xlwrite/poi_library/._xmlbeans-2.3.0.jar differ
diff --git a/Plugins/xlwrite/poi_library/LICENSE b/Plugins/xlwrite/poi_library/LICENSE
new file mode 100644
index 0000000..acc4be5
--- /dev/null
+++ b/Plugins/xlwrite/poi_library/LICENSE
@@ -0,0 +1,507 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+APACHE POI SUBCOMPONENTS:
+
+Apache POI includes subcomponents with separate copyright notices and
+license terms. Your use of these subcomponents is subject to the terms
+and conditions of the following licenses:
+
+
+Office Open XML schemas (ooxml-schemas-1.1.jar)
+
+ The Office Open XML schema definitions used by Apache POI are
+ a part of the Office Open XML ECMA Specification (ECMA-376, [1]).
+ As defined in section 9.4 of the ECMA bylaws [2], this specification
+ is available to all interested parties without restriction:
+
+ 9.4 All documents when approved shall be made available to
+ all interested parties without restriction.
+
+ Furthermore, both Microsoft and Adobe have granted patent licenses
+ to this work [3,4,5].
+
+ [1] http://www.ecma-international.org/publications/standards/Ecma-376.htm
+ [2] http://www.ecma-international.org/memento/Ecmabylaws.htm
+ [3] http://www.microsoft.com/interop/osp/
+ [4] http://www.ecma-international.org/publications/files/ECMA-ST/Ecma%20PATENT/ECMA-376%20Edition%201%20Microsoft%20Patent%20Declaration.pdf
+ [5] http://www.ecma-international.org/publications/files/ECMA-ST/Ecma%20PATENT/ga-2006-191.pdf
+
+
+DOM4J library (dom4j-1.6.1.jar)
+
+ Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
+
+ Redistribution and use of this software and associated documentation
+ ("Software"), with or without modification, are permitted provided
+ that the following conditions are met:
+
+ 1. Redistributions of source code must retain copyright
+ statements and notices. Redistributions must also contain a
+ copy of this document.
+
+ 2. Redistributions in binary form must reproduce the
+ above copyright notice, this list of conditions and the
+ following disclaimer in the documentation and/or other
+ materials provided with the distribution.
+
+ 3. The name "DOM4J" must not be used to endorse or promote
+ products derived from this Software without prior written
+ permission of MetaStuff, Ltd. For written permission,
+ please contact dom4j-info@metastuff.com.
+
+ 4. Products derived from this Software may not be called "DOM4J"
+ nor may "DOM4J" appear in their names without prior written
+ permission of MetaStuff, Ltd. DOM4J is a registered
+ trademark of MetaStuff, Ltd.
+
+ 5. Due credit should be given to the DOM4J Project -
+ http://www.dom4j.org
+
+ THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
+ NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+JUnit test library (junit-3.8.1.jar)
+
+ Common Public License - v 1.0
+
+ THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON
+ PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
+ OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+ 1. DEFINITIONS
+
+ "Contribution" means:
+
+ a) in the case of the initial Contributor, the initial code and
+ documentation distributed under this Agreement, and
+
+ b) in the case of each subsequent Contributor:
+
+ i) changes to the Program, and
+
+ ii) additions to the Program;
+
+ where such changes and/or additions to the Program originate from
+ and are distributed by that particular Contributor. A Contribution
+ 'originates' from a Contributor if it was added to the Program by
+ such Contributor itself or anyone acting on such Contributor's behalf.
+ Contributions do not include additions to the Program which: (i) are
+ separate modules of software distributed in conjunction with the
+ Program under their own license agreement, and (ii) are not derivative
+ works of the Program.
+
+ "Contributor" means any person or entity that distributes the Program.
+
+ "Licensed Patents " mean patent claims licensable by a Contributor which
+ are necessarily infringed by the use or sale of its Contribution alone
+ or when combined with the Program.
+
+ "Program" means the Contributions distributed in accordance with this
+ Agreement.
+
+ "Recipient" means anyone who receives the Program under this Agreement,
+ including all Contributors.
+
+ 2. GRANT OF RIGHTS
+
+ a) Subject to the terms of this Agreement, each Contributor hereby grants
+ Recipient a non-exclusive, worldwide, royalty-free copyright license
+ to reproduce, prepare derivative works of, publicly display, publicly
+ perform, distribute and sublicense the Contribution of such
+ Contributor, if any, and such derivative works, in source code and
+ object code form.
+
+ b) Subject to the terms of this Agreement, each Contributor hereby grants
+ Recipient a non-exclusive, worldwide, royalty-free patent license under
+ Licensed Patents to make, use, sell, offer to sell, import and
+ otherwise transfer the Contribution of such Contributor, if any, in
+ source code and object code form. This patent license shall apply to
+ the combination of the Contribution and the Program if, at the time
+ the Contribution is added by the Contributor, such addition of the
+ Contribution causes such combination to be covered by the Licensed
+ Patents. The patent license shall not apply to any other combinations
+ which include the Contribution. No hardware per se is licensed
+ hereunder.
+
+ c) Recipient understands that although each Contributor grants the
+ licenses to its Contributions set forth herein, no assurances are
+ provided by any Contributor that the Program does not infringe the
+ patent or other intellectual property rights of any other entity.
+ Each Contributor disclaims any liability to Recipient for claims
+ brought by any other entity based on infringement of intellectual
+ property rights or otherwise. As a condition to exercising the rights
+ and licenses granted hereunder, each Recipient hereby assumes sole
+ responsibility to secure any other intellectual property rights
+ needed, if any. For example, if a third party patent license is
+ required to allow Recipient to distribute the Program, it is
+ Recipient's responsibility to acquire that license before
+ distributing the Program.
+
+ d) Each Contributor represents that to its knowledge it has sufficient
+ copyright rights in its Contribution, if any, to grant the copyright
+ license set forth in this Agreement.
+
+ 3. REQUIREMENTS
+
+ A Contributor may choose to distribute the Program in object code form
+ under its own license agreement, provided that:
+
+ a) it complies with the terms and conditions of this Agreement; and
+
+ b) its license agreement:
+
+ i) effectively disclaims on behalf of all Contributors all warranties
+ and conditions, express and implied, including warranties or
+ conditions of title and non-infringement, and implied warranties
+ or conditions of merchantability and fitness for a particular
+ purpose;
+
+ ii) effectively excludes on behalf of all Contributors all liability
+ for damages, including direct, indirect, special, incidental and
+ consequential damages, such as lost profits;
+
+ iii) states that any provisions which differ from this Agreement are
+ offered by that Contributor alone and not by any other party; and
+
+ iv) states that source code for the Program is available from such
+ Contributor, and informs licensees how to obtain it in a
+ reasonable manner on or through a medium customarily used for
+ software exchange.
+
+ When the Program is made available in source code form:
+
+ a) it must be made available under this Agreement; and
+
+ b) a copy of this Agreement must be included with each copy of
+ the Program.
+
+ Contributors may not remove or alter any copyright notices contained
+ within the Program.
+
+ Each Contributor must identify itself as the originator of its
+ Contribution, if any, in a manner that reasonably allows subsequent
+ Recipients to identify the originator of the Contribution.
+
+ 4. COMMERCIAL DISTRIBUTION
+
+ Commercial distributors of software may accept certain responsibilities
+ with respect to end users, business partners and the like. While this
+ license is intended to facilitate the commercial use of the Program,
+ the Contributor who includes the Program in a commercial product offering
+ should do so in a manner which does not create potential liability for
+ other Contributors. Therefore, if a Contributor includes the Program
+ in a commercial product offering, such Contributor ("Commercial
+ Contributor") hereby agrees to defend and indemnify every other
+ Contributor ("Indemnified Contributor") against any losses, damages
+ and costs (collectively "Losses") arising from claims, lawsuits and
+ other legal actions brought by a third party against the Indemnified
+ Contributor to the extent caused by the acts or omissions of such
+ Commercial Contributor in connection with its distribution of the
+ Program in a commercial product offering. The obligations in this
+ section do not apply to any claims or Losses relating to any actual
+ or alleged intellectual property infringement. In order to qualify,
+ an Indemnified Contributor must: a) promptly notify the Commercial
+ Contributor in writing of such claim, and b) allow the Commercial
+ Contributor to control, and cooperate with the Commercial Contributor
+ in, the defense and any related settlement negotiations. The Indemnified
+ Contributor may participate in any such claim at its own expense.
+
+ For example, a Contributor might include the Program in a commercial
+ product offering, Product X. That Contributor is then a Commercial
+ Contributor. If that Commercial Contributor then makes performance
+ claims, or offers warranties related to Product X, those performance
+ claims and warranties are such Commercial Contributor's responsibility
+ alone. Under this section, the Commercial Contributor would have to
+ defend claims against the other Contributors related to those
+ performance claims and warranties, and if a court requires any other
+ Contributor to pay any damages as a result, the Commercial Contributor
+ must pay those damages.
+
+ 5. NO WARRANTY
+
+ EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED
+ ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER
+ EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR
+ CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR
+ A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+ determining the appropriateness of using and distributing the Program
+ and assumes all risks associated with its exercise of rights under this
+ Agreement, including but not limited to the risks and costs of program
+ errors, compliance with applicable laws, damage to or loss of data,
+ programs or equipment, and unavailability or interruption of operations.
+
+ 6. DISCLAIMER OF LIABILITY
+
+ EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR
+ ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+ WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
+ DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+ HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+ 7. GENERAL
+
+ If any provision of this Agreement is invalid or unenforceable under
+ applicable law, it shall not affect the validity or enforceability of
+ the remainder of the terms of this Agreement, and without further
+ action by the parties hereto, such provision shall be reformed to the
+ minimum extent necessary to make such provision valid and enforceable.
+
+ If Recipient institutes patent litigation against a Contributor with
+ respect to a patent applicable to software (including a cross-claim or
+ counterclaim in a lawsuit), then any patent licenses granted by that
+ Contributor to such Recipient under this Agreement shall terminate as of
+ the date such litigation is filed. In addition, if Recipient institutes
+ patent litigation against any entity (including a cross-claim or
+ counterclaim in a lawsuit) alleging that the Program itself (excluding
+ combinations of the Program with other software or hardware) infringes
+ such Recipient's patent(s), then such Recipient's rights granted under
+ Section 2(b) shall terminate as of the date such litigation is filed.
+
+ All Recipient's rights under this Agreement shall terminate if it fails
+ to comply with any of the material terms or conditions of this Agreement
+ and does not cure such failure in a reasonable period of time after
+ becoming aware of such noncompliance. If all Recipient's rights under
+ this Agreement terminate, Recipient agrees to cease use and distribution
+ of the Program as soon as reasonably practicable. However, Recipient's
+ obligations under this Agreement and any licenses granted by Recipient
+ relating to the Program shall continue and survive.
+
+ Everyone is permitted to copy and distribute copies of this Agreement,
+ but in order to avoid inconsistency the Agreement is copyrighted and may
+ only be modified in the following manner. The Agreement Steward reserves
+ the right to publish new versions (including revisions) of this Agreement
+ from time to time. No one other than the Agreement Steward has the right
+ to modify this Agreement. IBM is the initial Agreement Steward. IBM may
+ assign the responsibility to serve as the Agreement Steward to a suitable
+ separate entity. Each new version of the Agreement will be given a
+ distinguishing version number. The Program (including Contributions) may
+ always be distributed subject to the version of the Agreement under which
+ it was received. In addition, after a new version of the Agreement is
+ published, Contributor may elect to distribute the Program (including
+ its Contributions) under the new version. Except as expressly stated in
+ Sections 2(a) and 2(b) above, Recipient receives no rights or licenses
+ to the intellectual property of any Contributor under this Agreement,
+ whether expressly, by implication, estoppel or otherwise. All rights in
+ the Program not expressly granted under this Agreement are reserved.
+
+ This Agreement is governed by the laws of the State of New York and the
+ intellectual property laws of the United States of America. No party to
+ this Agreement will bring a legal action under this Agreement more than
+ one year after the cause of action arose. Each party waives its rights
+ to a jury trial in any resulting litigation.
diff --git a/Plugins/xlwrite/poi_library/dom4j-1.6.1.jar b/Plugins/xlwrite/poi_library/dom4j-1.6.1.jar
new file mode 100644
index 0000000..c8c4dbb
Binary files /dev/null and b/Plugins/xlwrite/poi_library/dom4j-1.6.1.jar differ
diff --git a/Plugins/xlwrite/poi_library/poi-3.8-20120326.jar b/Plugins/xlwrite/poi_library/poi-3.8-20120326.jar
new file mode 100644
index 0000000..edc0ee5
Binary files /dev/null and b/Plugins/xlwrite/poi_library/poi-3.8-20120326.jar differ
diff --git a/Plugins/xlwrite/poi_library/poi-ooxml-3.8-20120326.jar b/Plugins/xlwrite/poi_library/poi-ooxml-3.8-20120326.jar
new file mode 100644
index 0000000..9175c16
Binary files /dev/null and b/Plugins/xlwrite/poi_library/poi-ooxml-3.8-20120326.jar differ
diff --git a/Plugins/xlwrite/poi_library/poi-ooxml-schemas-3.8-20120326.jar b/Plugins/xlwrite/poi_library/poi-ooxml-schemas-3.8-20120326.jar
new file mode 100644
index 0000000..2372d1e
Binary files /dev/null and b/Plugins/xlwrite/poi_library/poi-ooxml-schemas-3.8-20120326.jar differ
diff --git a/Plugins/xlwrite/poi_library/stax-api-1.0.1.jar b/Plugins/xlwrite/poi_library/stax-api-1.0.1.jar
new file mode 100644
index 0000000..d9a1665
Binary files /dev/null and b/Plugins/xlwrite/poi_library/stax-api-1.0.1.jar differ
diff --git a/Plugins/xlwrite/poi_library/xmlbeans-2.3.0.jar b/Plugins/xlwrite/poi_library/xmlbeans-2.3.0.jar
new file mode 100644
index 0000000..ccd8163
Binary files /dev/null and b/Plugins/xlwrite/poi_library/xmlbeans-2.3.0.jar differ
diff --git a/Plugins/xlwrite/xlwrite.m b/Plugins/xlwrite/xlwrite.m
new file mode 100644
index 0000000..c181441
--- /dev/null
+++ b/Plugins/xlwrite/xlwrite.m
@@ -0,0 +1,292 @@
+function [status, message]=xlwrite(filename,A,sheet, range)
+% XLWRITE Write to Microsoft Excel spreadsheet file using Java
+% XLWRITE(FILE,ARRAY) writes ARRAY to the first worksheet in the Excel
+% file named FILE, starting at cell A1. It aims to have exactly the same
+% behaviour as XLSWRITE. See also XLSWRITE.
+%
+% XLWRITE(FILE,ARRAY,SHEET) writes to the specified worksheet.
+%
+% XLWRITE(FILE,ARRAY,RANGE) writes to the rectangular region
+% specified by RANGE in the first worksheet of the file. Specify RANGE
+% using the syntax 'C1:C2', where C1 and C2 are opposing corners of the
+% region.
+%
+% XLWRITE(FILE,ARRAY,SHEET,RANGE) writes to the specified SHEET and
+% RANGE.
+%
+% STATUS = XLWRITE(FILE,ARRAY,SHEET,RANGE) returns the completion
+% status of the write operation: TRUE (logical 1) for success, FALSE
+% (logical 0) for failure. Inputs SHEET and RANGE are optional.
+%
+% Input Arguments:
+%
+% FILE String that specifies the file to write. If the file does not
+% exist, XLWRITE creates a file, determining the format based on
+% the specified extension. To create a file compatible with Excel
+% 97-2003 software, specify an extension of '.xls'. If you do not
+% specify an extension, XLWRITE applies '.xls'.
+% ARRAY Two-dimensional logical, numeric or character array or, if each
+% cell contains a single element, a cell array.
+% SHEET Worksheet to write. One of the following:
+% * String that contains the worksheet name.
+% * Positive, integer-valued scalar indicating the worksheet
+% index.
+% If SHEET does not exist, XLWRITE adds a new sheet at the end
+% of the worksheet collection.
+% RANGE String that specifies a rectangular portion of the worksheet to
+% read. Not case sensitive. Use Excel A1 reference style.
+% * If you specify a SHEET, RANGE can either fit the size of
+% ARRAY or specify only the first cell (such as 'D2').
+% * If you do not specify a SHEET, RANGE must include both
+% corners and a colon character (:), even for a single cell
+% (such as 'D2:D2').
+% * If RANGE is larger than the size of ARRAY, Excel fills the
+% remainder of the region with #N/A. If RANGE is smaller than
+% the size of ARRAY, XLWRITE writes only the subset that fits
+% into RANGE to the file.
+%
+% Note
+% * This function requires the POI library to be in your javapath.
+% To add the Apache POI Library execute commands:
+% (This assumes the POI lib files are in folder 'poi_library')
+% javaaddpath('poi_library/poi-3.8-20120326.jar');
+% javaaddpath('poi_library/poi-ooxml-3.8-20120326.jar');
+% javaaddpath('poi_library/poi-ooxml-schemas-3.8-20120326.jar');
+% javaaddpath('poi_library/xmlbeans-2.3.0.jar');
+% javaaddpath('poi_library/dom4j-1.6.1.jar');
+% * Excel converts Inf values to 65535. XLWRITE converts NaN values to
+% empty cells.
+%
+% EXAMPLES
+% % Write a 7-element vector to testdata.xls:
+% xlwrite('testdata.xls', [12.7, 5.02, -98, 63.9, 0, -.2, 56])
+%
+% % Write mixed text and numeric data to testdata2.xls
+% % starting at cell E1 of Sheet1:
+% d = {'Time','Temperature'; 12,98; 13,99; 14,97};
+% xlwrite('testdata2.xls', d, 1, 'E1')
+%
+%
+% REVISIONS
+% 20121004 - First version using JExcelApi
+% 20121101 - Modified to use POI library instead of JExcelApi (allows to
+% generate XLSX)
+% 20121127 - Fixed bug: use existing rows if present, instead of
+% overwrite rows by default. Thanks to Dan & Jason.
+% 20121204 - Fixed bug: if a numeric sheet is given & didn't exist,
+% an error was returned instead of creating the sheet. Thanks to Marianna
+% 20130106 - Fixed bug: use existing cell if present, instead of
+% overwriting. This way original XLS formatting is kept & not
+% overwritten.
+% 20130125 - Fixed bug & documentation. Incorrect working of NaN. Thanks Klaus
+% 20130227 - Fixed bug when no sheet number given & added Stax to java
+% load. Thanks to Thierry
+%
+% Copyright 2012-2013, Alec de Zegher
+%==============================================================================
+
+% Check if POI lib is loaded
+if exist('org.apache.poi.ss.usermodel.WorkbookFactory', 'class') ~= 8 ...
+ || exist('org.apache.poi.hssf.usermodel.HSSFWorkbook', 'class') ~= 8 ...
+ || exist('org.apache.poi.xssf.usermodel.XSSFWorkbook', 'class') ~= 8
+
+ error('xlWrite:poiLibsNotLoaded',...
+ 'The POI library is not loaded in Matlab.\nCheck that POI jar files are in Matlab Java path!');
+end
+
+% Import required POI Java Classes
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.hssf.usermodel.*;
+import org.apache.poi.xssf.usermodel.*;
+import org.apache.poi.ss.usermodel.*;
+
+import org.apache.poi.ss.util.*;
+
+status=0;
+
+% If no sheet & xlrange is defined, attribute an empty value to it
+if nargin < 3; sheet = []; end
+if nargin < 4; range = []; end
+
+% Check if sheetvariable contains range data
+if nargin < 4 && ~isempty(strfind(sheet,':'))
+ range = sheet;
+ sheet = [];
+end
+
+% check if input data is given
+if isempty(A)
+ error('xlwrite:EmptyInput', 'Input array is empty!');
+end
+% Check that input data is not bigger than 2D
+if ndims(A) > 2
+ error('xlwrite:InputDimension', ...
+ 'Dimension of input array should not be higher than two.');
+end
+
+% Set java path to same path as Matlab path
+java.lang.System.setProperty('user.dir', pwd);
+
+% Open a file
+xlsFile = java.io.File(filename);
+
+% If file does not exist create a new workbook
+if xlsFile.isFile()
+ % create XSSF or HSSF workbook from existing workbook
+ fileIn = java.io.FileInputStream(xlsFile);
+ xlsWorkbook = WorkbookFactory.create(fileIn);
+else
+ % Create a new workbook based on the extension.
+ [~,~,fileExt] = fileparts(filename);
+
+ % Check based on extension which type to create. If no (valid)
+ % extension is given, create XLSX file
+ switch lower(fileExt)
+ case '.xls'
+ xlsWorkbook = HSSFWorkbook();
+ case '.xlsx'
+ xlsWorkbook = XSSFWorkbook();
+ otherwise
+ xlsWorkbook = XSSFWorkbook();
+
+ % Also update filename with added extension
+ filename = [filename '.xlsx'];
+ end
+end
+
+% If sheetname given, enter data in this sheet
+if ~isempty(sheet)
+ if isnumeric(sheet)
+ % Java uses 0-indexing, so take sheetnumer-1
+ % Check if the sheet can exist
+ if xlsWorkbook.getNumberOfSheets() >= sheet && sheet >= 1
+ xlsSheet = xlsWorkbook.getSheetAt(sheet-1);
+ else
+ % There are less number of sheets, that the requested sheet, so
+ % return an empty sheet
+ xlsSheet = [];
+ end
+ else
+ xlsSheet = xlsWorkbook.getSheet(sheet);
+ end
+
+ % Create a new sheet if it is empty
+ if isempty(xlsSheet)
+ warning('xlwrite:AddSheet', 'Added specified worksheet.');
+
+ % Add the sheet
+ if isnumeric(sheet)
+ xlsSheet = xlsWorkbook.createSheet(['Sheet ' num2str(sheet)]);
+ else
+ % Create a safe sheet name
+ sheet = WorkbookUtil.createSafeSheetName(sheet);
+ xlsSheet = xlsWorkbook.createSheet(sheet);
+ end
+ end
+
+else
+ % check number of sheets
+ nSheets = xlsWorkbook.getNumberOfSheets();
+
+ % If no sheets, create one
+ if nSheets < 1
+ xlsSheet = xlsWorkbook.createSheet('Sheet 1');
+ else
+ % Select the first sheet
+ xlsSheet = xlsWorkbook.getSheetAt(0);
+ end
+end
+
+% if range is not specified take start row & col at A1
+% locations are 0 indexed
+if isempty(range)
+ iRowStart = 0;
+ iColStart = 0;
+ iRowEnd = size(A, 1)-1;
+ iColEnd = size(A, 2)-1;
+else
+ % Split range in start & end cell
+ iSeperator = strfind(range, ':');
+ if isempty(iSeperator)
+ % Only start was defined as range
+ % Create a helper to get the row and column
+ cellStart = CellReference(range);
+ iRowStart = cellStart.getRow();
+ iColStart = cellStart.getCol();
+ % End column calculated based on size of A
+ iRowEnd = iRowStart + size(A, 1)-1;
+ iColEnd = iColStart + size(A, 2)-1;
+ else
+ % Define start & end cell
+ cellStart = range(1:iSeperator-1);
+ cellEnd = range(iSeperator+1:end);
+
+ % Create a helper to get the row and column
+ cellStart = CellReference(cellStart);
+ cellEnd = CellReference(cellEnd);
+
+ % Get start & end locations
+ iRowStart = cellStart.getRow();
+ iColStart = cellStart.getCol();
+ iRowEnd = cellEnd.getRow();
+ iColEnd = cellEnd.getCol();
+ end
+end
+
+% Get number of elements in A (0-indexed)
+nRowA = size(A, 1)-1;
+nColA = size(A, 2)-1;
+
+% If data is a cell, convert it
+if ~iscell(A)
+ A = num2cell(A);
+end
+
+% Iterate over all data
+for iRow = iRowStart:iRowEnd
+ % Fetch the row (if it exists)
+ currentRow = xlsSheet.getRow(iRow);
+ if isempty(currentRow)
+ % Create a new row, as it does not exist yet
+ currentRow = xlsSheet.createRow(iRow);
+ end
+
+ % enter data for all cols
+ for iCol = iColStart:iColEnd
+ % Check if cell exists
+ currentCell = currentRow.getCell(iCol);
+ if isempty(currentCell)
+ % Create a new cell, as it does not exist yet
+ currentCell = currentRow.createCell(iCol);
+ end
+
+ % Check if we are still in array A
+ if (iRow-iRowStart)<=nRowA && (iCol-iColStart)<=nColA
+ % Fetch the data
+ data = A{iRow-iRowStart+1, iCol-iColStart+1};
+
+ if ~isempty(data)
+ % if it is a NaN value, convert it to an empty string
+ if isnumeric(data) && isnan(data)
+ data = '';
+ end
+
+ % Write data to cell
+ currentCell.setCellValue(data);
+ end
+
+ else
+ % Set field to NA
+ currentCell.setCellErrorValue(FormulaError.NA.getCode());
+ end
+ end
+end
+
+% Write & close the workbook
+fileOut = java.io.FileOutputStream(filename);
+xlsWorkbook.write(fileOut);
+fileOut.close();
+
+status = 1;
+
+end
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..74d88fe
--- /dev/null
+++ b/README.md
@@ -0,0 +1 @@
+# kardia
diff --git a/Sample Data/._IBIs b/Sample Data/._IBIs
new file mode 100644
index 0000000..2af7e54
Binary files /dev/null and b/Sample Data/._IBIs differ
diff --git a/Sample Data/._events b/Sample Data/._events
new file mode 100644
index 0000000..2af7e54
Binary files /dev/null and b/Sample Data/._events differ
diff --git a/Sample Data/._sample analysis.mat b/Sample Data/._sample analysis.mat
new file mode 100644
index 0000000..46f3a6f
Binary files /dev/null and b/Sample Data/._sample analysis.mat differ
diff --git a/Sample Data/._test.xls b/Sample Data/._test.xls
new file mode 100644
index 0000000..46f3a6f
Binary files /dev/null and b/Sample Data/._test.xls differ
diff --git a/Sample Data/IBIs/._i3108_im.mat b/Sample Data/IBIs/._i3108_im.mat
new file mode 100644
index 0000000..32f87f2
Binary files /dev/null and b/Sample Data/IBIs/._i3108_im.mat differ
diff --git a/Sample Data/IBIs/._i3111_im.mat b/Sample Data/IBIs/._i3111_im.mat
new file mode 100644
index 0000000..32f87f2
Binary files /dev/null and b/Sample Data/IBIs/._i3111_im.mat differ
diff --git a/Sample Data/IBIs/._i3114_im.mat b/Sample Data/IBIs/._i3114_im.mat
new file mode 100644
index 0000000..32f87f2
Binary files /dev/null and b/Sample Data/IBIs/._i3114_im.mat differ
diff --git a/Sample Data/IBIs/._i3118_im.mat b/Sample Data/IBIs/._i3118_im.mat
new file mode 100644
index 0000000..32f87f2
Binary files /dev/null and b/Sample Data/IBIs/._i3118_im.mat differ
diff --git a/Sample Data/IBIs/._i3119_im.mat b/Sample Data/IBIs/._i3119_im.mat
new file mode 100644
index 0000000..32f87f2
Binary files /dev/null and b/Sample Data/IBIs/._i3119_im.mat differ
diff --git a/Sample Data/IBIs/i3108_im.mat b/Sample Data/IBIs/i3108_im.mat
new file mode 100644
index 0000000..060f918
Binary files /dev/null and b/Sample Data/IBIs/i3108_im.mat differ
diff --git a/Sample Data/IBIs/i3111_im.mat b/Sample Data/IBIs/i3111_im.mat
new file mode 100644
index 0000000..033e8df
Binary files /dev/null and b/Sample Data/IBIs/i3111_im.mat differ
diff --git a/Sample Data/IBIs/i3114_im.mat b/Sample Data/IBIs/i3114_im.mat
new file mode 100644
index 0000000..374057b
Binary files /dev/null and b/Sample Data/IBIs/i3114_im.mat differ
diff --git a/Sample Data/IBIs/i3118_im.mat b/Sample Data/IBIs/i3118_im.mat
new file mode 100644
index 0000000..3b1e07d
Binary files /dev/null and b/Sample Data/IBIs/i3118_im.mat differ
diff --git a/Sample Data/IBIs/i3119_im.mat b/Sample Data/IBIs/i3119_im.mat
new file mode 100644
index 0000000..c48cfd4
Binary files /dev/null and b/Sample Data/IBIs/i3119_im.mat differ
diff --git a/Sample Data/events/._ti3108.mat b/Sample Data/events/._ti3108.mat
new file mode 100644
index 0000000..32f87f2
Binary files /dev/null and b/Sample Data/events/._ti3108.mat differ
diff --git a/Sample Data/events/._ti3111.mat b/Sample Data/events/._ti3111.mat
new file mode 100644
index 0000000..32f87f2
Binary files /dev/null and b/Sample Data/events/._ti3111.mat differ
diff --git a/Sample Data/events/._ti3114.mat b/Sample Data/events/._ti3114.mat
new file mode 100644
index 0000000..32f87f2
Binary files /dev/null and b/Sample Data/events/._ti3114.mat differ
diff --git a/Sample Data/events/._ti3118.mat b/Sample Data/events/._ti3118.mat
new file mode 100644
index 0000000..32f87f2
Binary files /dev/null and b/Sample Data/events/._ti3118.mat differ
diff --git a/Sample Data/events/._ti3119.mat b/Sample Data/events/._ti3119.mat
new file mode 100644
index 0000000..32f87f2
Binary files /dev/null and b/Sample Data/events/._ti3119.mat differ
diff --git a/Sample Data/events/ti3108.mat b/Sample Data/events/ti3108.mat
new file mode 100644
index 0000000..1446a0c
Binary files /dev/null and b/Sample Data/events/ti3108.mat differ
diff --git a/Sample Data/events/ti3111.mat b/Sample Data/events/ti3111.mat
new file mode 100644
index 0000000..bb3e92d
Binary files /dev/null and b/Sample Data/events/ti3111.mat differ
diff --git a/Sample Data/events/ti3114.mat b/Sample Data/events/ti3114.mat
new file mode 100644
index 0000000..2d9d99e
Binary files /dev/null and b/Sample Data/events/ti3114.mat differ
diff --git a/Sample Data/events/ti3118.mat b/Sample Data/events/ti3118.mat
new file mode 100644
index 0000000..8a93f9f
Binary files /dev/null and b/Sample Data/events/ti3118.mat differ
diff --git a/Sample Data/events/ti3119.mat b/Sample Data/events/ti3119.mat
new file mode 100644
index 0000000..39e15c0
Binary files /dev/null and b/Sample Data/events/ti3119.mat differ
diff --git a/Sample Data/sample analysis.mat b/Sample Data/sample analysis.mat
new file mode 100644
index 0000000..1c79de2
Binary files /dev/null and b/Sample Data/sample analysis.mat differ
diff --git a/Sample Data/test.xls b/Sample Data/test.xls
new file mode 100644
index 0000000..e6f7301
Binary files /dev/null and b/Sample Data/test.xls differ
diff --git a/gui_export.mat b/gui_export.mat
new file mode 100644
index 0000000..5fd50d2
Binary files /dev/null and b/gui_export.mat differ
diff --git a/kardia.jpg b/kardia.jpg
new file mode 100644
index 0000000..e1560a6
Binary files /dev/null and b/kardia.jpg differ
diff --git a/kardia.m b/kardia.m
new file mode 100644
index 0000000..bee89e9
--- /dev/null
+++ b/kardia.m
@@ -0,0 +1,3698 @@
+% KARDIA ("heart" in Greek) is a graphic user interface (GUI) designed
+% for the analysis of cardiac interbeat interval (IBI) data. KARDIA allows
+% interactive importing and visualization of both IBI data and event-related
+% information. Available functions permit the analysis of phasic heart rate
+% changes in response to specific visual or auditory stimuli, using either
+% weighted averages or different interpolation methods (constant, linear,
+% spline) at any user-defined sampling rate. KARDIA also provides the user
+% with functions to calculate all commonly used time-domain statistics of
+% heart rate variability and to perform spectral decomposition by using
+% either Fast Fourier Transform or auto-regressive model. Scaling properties
+% of the IBI series can also be assessed by means of Detrended Fluctuation
+% Analysis. Quantitative results can be easily exported in Excel or MATLAB
+% format for further statistical analysis.
+%
+% To start the GUI type "kardia" in the command window. For usage information
+% launch the User's Guide from the toolbox
+%
+% KARDIA 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.
+%
+% KARDIA 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 KARDIA. If not, see .
+%
+% This software is freely available at:
+% www.ugr.es/~peraka/home/kardia.html
+%
+% Copyright (C) 2007 2008 Pandelis Perakakis,
+% University of Granada
+% email: peraka@ugr.es
+%
+% Update v2.3 - 16/09/2008 - New GUI
+%
+% Update v2.4 - 30/09/2008 - Unit option in ECP
+%
+% Update v2.5 - 12/10/2008 - Correct HRV variable order for Excel output
+%
+% Update v2.6 - 30/10/2008 - Fix concatenation problem in mean algorithm of
+% ECP
+%
+% Update v2.7 - 8/2/2009 - Compatibility with Matlab version 7,
+% 'Evoked Cardiac Potentials' changed to 'Phasic Cardiac Responses',
+% 'Import' changed to 'Load'
+%
+% Update v2.8 - 22/01/2012 - Include coefficient to compensate for
+% windowing in spectral analysis, more precice number of windows included
+% PCR
+% Update v2.9 - 10/06/2015 - Fix export data to mat function
+
+
+function main_figure = kardia(DATA)
+
+if nargin <1
+ clearFcn
+end
+
+load gui_export.mat
+
+%% ---------- GUI LAYOUT -----------
+
+%% Main Figure
+main_figure = figure(...
+ 'Units','characters',...
+ 'PaperUnits',get(0,'defaultfigurePaperUnits'),...
+ 'Color',[0.87843137254902 0.874509803921569 0.890196078431373],...
+ 'Colormap',[0 0 0.5625;0 0 0.625;0 0 0.6875;0 0 0.75;0 0 0.8125;0 0 0.875;0 0 0.9375;0 0 1;0 0.0625 1;0 0.125 1;0 0.1875 1;0 0.25 1;0 0.3125 1;0 0.375 1;0 0.4375 1;0 0.5 1;0 0.5625 1;0 0.625 1;0 0.6875 1;0 0.75 1;0 0.8125 1;0 0.875 1;0 0.9375 1;0 1 1;0.0625 1 1;0.125 1 0.9375;0.1875 1 0.875;0.25 1 0.8125;0.3125 1 0.75;0.375 1 0.6875;0.4375 1 0.625;0.5 1 0.5625;0.5625 1 0.5;0.625 1 0.4375;0.6875 1 0.375;0.75 1 0.3125;0.8125 1 0.25;0.875 1 0.1875;0.9375 1 0.125;1 1 0.0625;1 1 0;1 0.9375 0;1 0.875 0;1 0.8125 0;1 0.75 0;1 0.6875 0;1 0.625 0;1 0.5625 0;1 0.5 0;1 0.4375 0;1 0.375 0;1 0.3125 0;1 0.25 0;1 0.1875 0;1 0.125 0;1 0.0625 0;1 0 0;0.9375 0 0;0.875 0 0;0.8125 0 0;0.75 0 0;0.6875 0 0;0.625 0 0;0.5625 0 0],...
+ 'IntegerHandle','off',...
+ 'InvertHardcopy',get(0,'defaultfigureInvertHardcopy'),...
+ 'MenuBar','none',...
+ 'Name','KARDIA v2.8',...
+ 'NumberTitle','off',...
+ 'PaperPositionMode','auto',...
+ 'PaperSize',[20.98404194812 29.67743169791],...
+ 'PaperType',get(0,'defaultfigurePaperType'),...
+ 'Position',[1.80000000000001 1.38461538461542 201.8 53.0769230769231],...
+ 'HandleVisibility','callback',...
+ 'Tag','main_figure',...
+ 'UserData',[]);
+
+%% KARDIA image
+axes_kardia_image = axes(...
+ 'Parent',main_figure,...
+ 'Position',[0.0089197224975223 0.649275362318841 0.288404360753221 0.320289855072464],...
+ 'CameraPosition',[0.5 0.5 9.16025403784439],...
+ 'CameraPositionMode',get(0,'defaultaxesCameraPositionMode'),...
+ 'Color',get(0,'defaultaxesColor'),...
+ 'ColorOrder',get(0,'defaultaxesColorOrder'),...
+ 'LooseInset',[0.128882521489971 0.100454545454546 0.0941833810888252 0.0684917355371901],...
+ 'XColor',get(0,'defaultaxesXColor'),...
+ 'YColor',get(0,'defaultaxesYColor'),...
+ 'ZColor',get(0,'defaultaxesZColor'),...
+ 'Tag','axes_kardia_image',...
+ 'CreateFcn',@plot_kardia);
+
+%% Load
+%% ---- Load Data
+panel_load_data = uipanel(...
+ 'Parent',main_figure,...
+ 'Title','Load Data',...
+ 'Tag','panel_load_data',...
+ 'UserData',[],...
+ 'Clipping','on',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'Position',[0.00792864222001982 0.373913043478261 0.150644202180377 0.26231884057971]);
+
+txt_channel_data = uicontrol(...
+ 'Parent',panel_load_data,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.0273972602739726 0.872727272727273 0.321917808219178 0.0909090909090909],...
+ 'String','Channel',...
+ 'Style','text',...
+ 'Tag','txt_channel_data');
+
+txt_datavar_data = uicontrol(...
+ 'Parent',panel_load_data,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.027027027027027 0.660606060606061 0.290540540540541 0.109090909090909],...
+ 'String','Data var',...
+ 'Style','text',...
+ 'Tag','txt_datavar_data');
+
+txt_unit_data = uicontrol(...
+ 'Parent',panel_load_data,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.0297619047619047 0.272727272727273 0.172619047619048 0.0909090909090909],...
+ 'String','Unit',...
+ 'Style','text',...
+ 'Tag','txt_unit_data');
+
+txt_format_data = uicontrol(...
+ 'Parent',panel_load_data,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.0297619047619047 0.484848484848485 0.244047619047619 0.0727272727272727],...
+ 'String','Format',...
+ 'Style','text',...
+ 'Tag','txt_format_data');
+
+edit_channel_data = uicontrol(...
+ 'Parent',panel_load_data,...
+ 'Units','normalized',...
+ 'BackgroundColor',[1 1 1],...
+ 'CData',[],...
+ 'Position',[0.349315068493149 0.848484848484849 0.246575342465753 0.127272727272727],...
+ 'String','1',...
+ 'Style','edit',...
+ 'Value',1,...
+ 'Tag','edit_channel_data',...
+ 'UserData',[]);
+
+edit_unit_data = uicontrol(...
+ 'Parent',panel_load_data,...
+ 'Units','normalized',...
+ 'BackgroundColor',[1 1 1],...
+ 'CData',[],...
+ 'Position',[0.349315068493151 0.266666666666667 0.513698630136986 0.121212121212121],...
+ 'String',{ 'sec '; 'ms' },...
+ 'Style','popupmenu',...
+ 'Value',1,...
+ 'Tag','edit_unit_data',...
+ 'UserData',[]);
+
+edit_format_data = uicontrol(...
+ 'Parent',panel_load_data,...
+ 'Units','normalized',...
+ 'BackgroundColor',[1 1 1],...
+ 'CData',[],...
+ 'Position',[0.349315068493151 0.454545454545455 0.547945205479452 0.121212121212121],...
+ 'String',{ 'R events'; 'IBIs' },...
+ 'Style','popupmenu',...
+ 'Value',1,...
+ 'Tag','edit_format_data',...
+ 'UserData',[]);
+
+edit_datavar_data = uicontrol(...
+ 'Parent',panel_load_data,...
+ 'Units','normalized',...
+ 'BackgroundColor',[1 1 1],...
+ 'CData',[],...
+ 'Position',[0.349315068493149 0.660606060606061 0.328767123287671 0.127272727272727],...
+ 'String',blanks(0),...
+ 'Style','edit',...
+ 'Value',[],...
+ 'Tag','edit_datavar_data',...
+ 'UserData',[]);
+
+push_ok_data = uicontrol(...
+ 'Parent',panel_load_data,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'Callback','loaddata_callback',...
+ 'Position',[0.328767123287671 0.0545454545454545 0.424657534246575 0.145454545454545],...
+ 'String','ok',...
+ 'Tag','push_ok_data',...
+ 'callback',@load_data_callback);
+
+%% ---- Load Events
+panel_load_events = uipanel(...
+ 'Parent',main_figure,...
+ 'Title','Load Events',...
+ 'Tag','panel_load_events',...
+ 'UserData',[],...
+ 'Clipping','on',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'Position',[0.163528245787909 0.373913043478261 0.133795837462834 0.26231884057971]);
+
+txt_latvar_events = uicontrol(...
+ 'Parent',panel_load_events,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.0236220472440945 0.691306058221873 0.543307086614173 0.0914634146341464],...
+ 'String','Latencies var',...
+ 'Style','text',...
+ 'Tag','txt_latvar_events');
+
+txt_condvar_events = uicontrol(...
+ 'Parent',panel_load_events,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.0305343511450382 0.478787878787879 0.549618320610687 0.0909090909090909],...
+ 'String','Conditions var',...
+ 'Style','text',...
+ 'Tag','txt_condvar_events');
+
+txt_unit_events = uicontrol(...
+ 'Parent',panel_load_events,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.0305343511450382 0.258064516129032 0.229007633587786 0.0967741935483871],...
+ 'String','Unit',...
+ 'Style','text',...
+ 'Tag','txt_unit_events');
+
+edit_latvar_events = uicontrol(...
+ 'Parent',panel_load_events,...
+ 'Units','normalized',...
+ 'BackgroundColor',[1 1 1],...
+ 'CData',[],...
+ 'Position',[0.595419847328244 0.666666666666667 0.381679389312977 0.127272727272727],...
+ 'String',blanks(0),...
+ 'Style','edit',...
+ 'Value',[],...
+ 'Tag','edit_latvar_events',...
+ 'UserData',[]);
+
+pop_unit_events = uicontrol(...
+ 'Parent',panel_load_events,...
+ 'Units','normalized',...
+ 'BackgroundColor',[1 1 1],...
+ 'Position',[0.595419847328244 0.245161290322581 0.351145038167939 0.12258064516129],...
+ 'String',{ 'sec'; 'ms' },...
+ 'Style','popupmenu',...
+ 'Value',1,...
+ 'Tag','pop_unit_events');
+
+edit_condvar_events = uicontrol(...
+ 'Parent',panel_load_events,...
+ 'Units','normalized',...
+ 'BackgroundColor',[1 1 1],...
+ 'CData',[],...
+ 'Position',[0.595419847328244 0.466666666666667 0.381679389312977 0.127272727272727],...
+ 'String',blanks(0),...
+ 'Style','edit',...
+ 'Value',[],...
+ 'Tag','edit_condvar_events',...
+ 'UserData',[]);
+
+push_ok_events = uicontrol(...
+ 'Parent',panel_load_events,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'Callback',@load_events_callback,...
+ 'Position',[0.259842519685039 0.0487804878048781 0.488188976377953 0.146341463414634],...
+ 'String','ok',...
+ 'Tag','push_ok_events');
+
+txt_subject_events = uicontrol(...
+ 'Parent',panel_load_events,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.0229007633587786 0.872727272727273 0.312977099236641 0.0909090909090909],...
+ 'String','Subject',...
+ 'Style','text',...
+ 'Tag','txt_subject_events');
+
+pop_subject_events = uicontrol(...
+ 'Parent',panel_load_events,...
+ 'Units','normalized',...
+ 'BackgroundColor',[1 1 1],...
+ 'CData',[],...
+ 'Position',[0.404580152671756 0.842424242424242 0.572519083969466 0.133333333333333],...
+ 'String',{ blanks(0)},...
+ 'Style','popupmenu',...
+ 'Value',1,...
+ 'Tag','pop_subject_events',...
+ 'UserData',[]);
+
+%% PCR
+panel_PCR = uipanel(...
+ 'Parent',main_figure,...
+ 'Title','Phasic Cardiac Responses',...
+ 'Tag','panel_PCR',...
+ 'Clipping','on',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'Position',[0.0089197224975223 0.0130434782608696 0.288404360753221 0.347826086956522]);
+
+push_selectconds_PCR = uicontrol(...
+ 'Parent',panel_PCR,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'Callback',@PCR_conditions_callback,...
+ 'Position',[0.0313588850174216 0.834821428571428 0.331010452961672 0.102678571428571],...
+ 'String','Select conditions',...
+ 'Tag','push_selectconds_PCR');
+
+txt_epochstart_PCR = uicontrol(...
+ 'Parent',panel_PCR,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'CData',[],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.0323741007194245 0.710765098722417 0.233812949640288 0.0609756097560976],...
+ 'String','Epoch start',...
+ 'Style','text',...
+ 'Tag','txt_epochstart_PCR',...
+ 'UserData',[]);
+
+edit_epochend_PCR = uicontrol(...
+ 'Parent',panel_PCR,...
+ 'Units','normalized',...
+ 'BackgroundColor',[1 1 1],...
+ 'Position',[0.75 0.690439895470383 0.179856115107914 0.0934959349593497],...
+ 'String',[],...
+ 'Style','edit',...
+ 'Tag','edit_epochend_PCR');
+
+txt_epochend_PCR = uicontrol(...
+ 'Parent',panel_PCR,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'Position',[0.505030562016552 0.70786799646534 0.204828618308361 0.0646281240590184],...
+ 'String','Epoch end',...
+ 'Style','text',...
+ 'Tag','txt_epochend_PCR');
+
+edit_epochstart_PCR = uicontrol(...
+ 'Parent',panel_PCR,...
+ 'Units','normalized',...
+ 'BackgroundColor',[1 1 1],...
+ 'Position',[0.28 0.690439895470383 0.165467625899281 0.0934959349593497],...
+ 'String',[],...
+ 'Style','edit',...
+ 'Tag','edit_epochstart_PCR');
+
+txt_algorithm_PCR = uicontrol(...
+ 'Parent',panel_PCR,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.0313588850174216 0.535 0.212543554006969 0.0669642857142857],...
+ 'String','Algorithm',...
+ 'Style','text',...
+ 'Tag','txt_algorithm_PCR');
+
+pop_algorithm_PCR = uicontrol(...
+ 'Parent',panel_PCR,...
+ 'Units','normalized',...
+ 'BackgroundColor',[1 1 1],...
+ 'Position',[0.28 0.531957126245529 0.303402390869259 0.0917795844625113],...
+ 'String',{ 'mean'; 'CDR'; 'constant'; 'linear'; 'spline' },...
+ 'Style','popupmenu',...
+ 'Value',1,...
+ 'Tag','pop_algorithm_PCR');
+
+txt_unit_PCR = uicontrol(...
+ 'Parent',panel_PCR,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.65 0.535 0.212543554006969 0.0669642857142857],...
+ 'String','Unit',...
+ 'Style','text',...
+ 'Tag','txt_unit_PCR');
+
+pop_unit_PCR = uicontrol(...
+ 'Parent',panel_PCR,...
+ 'Units','normalized',...
+ 'BackgroundColor',[1 1 1],...
+ 'Position',[0.75 0.53 0.2 0.0917795844625113],...
+ 'String',{'bpm'; 'sec'},...
+ 'Style','popupmenu',...
+ 'Value',1,...
+ 'Tag','pop_unit_PCR');
+
+txt_timewindow_PCR = uicontrol(...
+ 'Parent',panel_PCR,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.0323741007194245 0.397756968641115 0.262589928057554 0.0691056910569106],...
+ 'String','Time Window',...
+ 'Style','text',...
+ 'Tag','txt_timewindow_PCR');
+
+edit_timewindow_PCR = uicontrol(...
+ 'Parent',panel_PCR,...
+ 'Units','normalized',...
+ 'BackgroundColor',[1 1 1],...
+ 'Position',[0.28 0.401822009291522 0.161870503597122 0.0853658536585366],...
+ 'String','1',...
+ 'Style','edit',...
+ 'Value',1,...
+ 'Tag','edit_timewindow_PCR');
+
+check_removebsl_PCR = uicontrol(...
+ 'Parent',panel_PCR,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'Position',[0.0313588850174216 0.241071428571428 0.40418118466899 0.0669642857142857],...
+ 'String','Remove baseline',...
+ 'Style','checkbox',...
+ 'Value',1,...
+ 'Tag','check_removebsl_PCR');
+
+push_ok_PCR = uicontrol(...
+ 'Parent',panel_PCR,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'Callback',@PCR_callback,...
+ 'Position',[0.379790940766551 0.0758928571428571 0.222996515679443 0.0982142857142857],...
+ 'String','ok',...
+ 'Tag','push_ok_PCR');
+
+%% HRV
+panel_HRV = uipanel(...
+ 'Parent',main_figure,...
+ 'Title','HRV',...
+ 'Tag','panel_HRV',...
+ 'UserData',[],...
+ 'Clipping','on',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'Position',[0.306243805748266 0.0115942028985507 0.278493557978196 0.972463768115942]);
+
+%% ---- Epoch Data
+panel_epochdata = uipanel(...
+ 'Parent',panel_HRV,...
+ 'Title','Epoch Data',...
+ 'Tag','panel_epochdata_HRV',...
+ 'UserData',[],...
+ 'Clipping','on',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'Position',[0.0323741007194245 0.788148148148148 0.93884892086331 0.198518518518519]);
+
+push_selectconds_HRV = uicontrol(...
+ 'Parent',panel_epochdata,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'Callback',@HRV_conditions_callback,...
+ 'Position',[0.02734375 0.728070175438596 0.40078125 0.228070175438596],...
+ 'String','Select conditions',...
+ 'Tag','push_selectconds_HRV');
+
+txt_epochstart_HRV = uicontrol(...
+ 'Parent',panel_epochdata,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.02734375 0.508771929824561 0.22265625 0.12280701754386],...
+ 'String','Epoch start',...
+ 'Style','text',...
+ 'Tag','txt_epochstart_HRV');
+
+edit_epochend_HRV = uicontrol(...
+ 'Parent',panel_epochdata,...
+ 'Units','normalized',...
+ 'BackgroundColor',[1 1 1],...
+ 'Position',[0.696528453307393 0.478870145259429 0.151750972762646 0.186440677966102],...
+ 'String',[],...
+ 'Style','edit',...
+ 'Tag','edit_epochend_HRV');
+
+txt_epochend_HRV = uicontrol(...
+ 'Parent',panel_epochdata,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.463065418287938 0.512768450344175 0.206225680933852 0.127118644067797],...
+ 'String','Epoch end',...
+ 'Style','text',...
+ 'Tag','txt_epochend_HRV');
+
+edit_epochstart_HRV = uicontrol(...
+ 'Parent',panel_epochdata,...
+ 'Units','normalized',...
+ 'BackgroundColor',[1 1 1],...
+ 'Position',[0.287968142023346 0.478870145259429 0.147859922178988 0.177966101694915],...
+ 'String',[],...
+ 'Style','edit',...
+ 'Tag','edit_epochstart_HRV');
+
+% push_rejectartifacts_HRV = uicontrol(...
+% 'Parent',panel_epochdata,...
+% 'Units','normalized',...
+% 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+% 'Position',[0.02734375 0.114035087719298 0.33203125 0.210526315789474],...
+% 'String','Reject artifacts',...
+% 'Tag','push_rejectartifacts_HRV');
+
+push_epochdata_HRV = uicontrol(...
+ 'Parent',panel_epochdata,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'Callback',@epochdata_callback,...
+ 'Position',[0.4375 0.114035087719298 0.20703125 0.201754385964912],...
+ 'String','ok',...
+ 'Tag','push_epochdata_HRV');
+
+%% ---- Spectral Analysis
+panel_spectral = uipanel(...
+ 'Parent',panel_HRV,...
+ 'Title','Spectral Analysis',...
+ 'Tag','panel_spectral',...
+ 'UserData',[],...
+ 'Clipping','on',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'Position',[0.0324909747292419 0.270229007633588 0.942238267148015 0.493129770992366]);
+
+txt_samplerate = uicontrol(...
+ 'Parent',panel_spectral,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.0350194552529183 0.920634920634921 0.252918287937743 0.0476190476190476],...
+ 'String','Sample Rate',...
+ 'Style','text',...
+ 'Tag','txt_samplerate');
+
+pop_samplerate = uicontrol(...
+ 'Parent',panel_spectral,...
+ 'Units','normalized',...
+ 'BackgroundColor',[1 1 1],...
+ 'Position',[0.385214007782101 0.898412698412699 0.21011673151751 0.073015873015873],...
+ 'String',{ '2'; '4' },...
+ 'Style','popupmenu',...
+ 'Value',1,...
+ 'Tag','pop_samplerate');
+
+txt_detrendmethod = uicontrol(...
+ 'Parent',panel_spectral,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.0350194552529183 0.676190476190476 0.307392996108949 0.053968253968254],...
+ 'String','Detrend method',...
+ 'Style','text',...
+ 'Tag','txt_detrendmethod');
+
+push_ok_spectral = uicontrol(...
+ 'Parent',panel_spectral,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'Callback',@spectral_callback,...
+ 'Position',[0.385214007782101 0.0507936507936508 0.206225680933852 0.0761904761904762],...
+ 'String','ok',...
+ 'Tag','push_ok_spectral');
+
+txt_points = uicontrol(...
+ 'Parent',panel_spectral,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.0350194552529183 0.793650793650794 0.136186770428016 0.0634920634920635],...
+ 'String','Points',...
+ 'Style','text',...
+ 'Tag','txt_points');
+
+txt_Filter = uicontrol(...
+ 'Parent',panel_spectral,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.03515625 0.557377049180328 0.21875 0.0524590163934426],...
+ 'String','Windowing',...
+ 'Style','text',...
+ 'Tag','txt_Filter');
+
+txt_ARorder = uicontrol(...
+ 'Parent',panel_spectral,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.0350194552529183 0.311111111111111 0.217898832684825 0.0476190476190476],...
+ 'String','AR order',...
+ 'Style','text',...
+ 'Tag','txt_ARorder');
+
+txt_algorithm_spectral = uicontrol(...
+ 'Parent',panel_spectral,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.0350194552529183 0.422222222222222 0.21011673151751 0.073015873015873],...
+ 'String','Algorithm',...
+ 'Style','text',...
+ 'Tag','txt_algorithm_spectral');
+
+txt_scale = uicontrol(...
+ 'Parent',panel_spectral,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.0350194552529183 0.193650793650794 0.151750972762646 0.053968253968254],...
+ 'String','Scale',...
+ 'Style','text',...
+ 'Tag','txt_scale');
+
+pop_detrendmethod = uicontrol(...
+ 'Parent',panel_spectral,...
+ 'Units','normalized',...
+ 'BackgroundColor',[1 1 1],...
+ 'Position',[0.390625 0.668852459016393 0.3125 0.0655737704918033],...
+ 'String',{ 'constant'; 'linear' },...
+ 'Style','popupmenu',...
+ 'Value',1,...
+ 'Tag','pop_detrendmethod');
+
+pop_points = uicontrol(...
+ 'Parent',panel_spectral,...
+ 'Units','normalized',...
+ 'BackgroundColor',[1 1 1],...
+ 'Position',[0.389105058365759 0.79047619047619 0.21011673151751 0.073015873015873],...
+ 'String',{ '512'; '1024'; 'auto' },...
+ 'Style','popupmenu',...
+ 'Value',1,...
+ 'Tag','pop_points');
+
+pop_Filter = uicontrol(...
+ 'Parent',panel_spectral,...
+ 'Units','normalized',...
+ 'BackgroundColor',[1 1 1],...
+ 'Position',[0.390625 0.554098360655738 0.31640625 0.0655737704918033],...
+ 'String',{ 'Hanning'; 'Hamming'; 'Blackman'; 'Bartlett' },...
+ 'Style','popupmenu',...
+ 'Value',1,...
+ 'Tag','pop_Filter');
+
+edit_ARorder = uicontrol(...
+ 'Parent',panel_spectral,...
+ 'Units','normalized',...
+ 'BackgroundColor',[1 1 1],...
+ 'Position',[0.389105058365759 0.298412698412699 0.151750972762646 0.0666666666666667],...
+ 'String','16',...
+ 'Style','edit',...
+ 'Value',1,...
+ 'Tag','edit_ARorder');
+
+pop_algorithm_spectral = uicontrol(...
+ 'Parent',panel_spectral,...
+ 'Units','normalized',...
+ 'BackgroundColor',[1 1 1],...
+ 'Position',[0.390625 0.429508196721312 0.30078125 0.0688524590163934],...
+ 'String',{ 'FFT'; 'AR-Burg' },...
+ 'Style','popupmenu',...
+ 'Value',1,...
+ 'Tag','pop_algorithm_spectral');
+
+pop_scale = uicontrol(...
+ 'Parent',panel_spectral,...
+ 'Units','normalized',...
+ 'BackgroundColor',[1 1 1],...
+ 'Position',[0.390625 0.19016393442623 0.29296875 0.0655737704918033],...
+ 'String',{ 'normal '; 'log'; 'semilog' },...
+ 'Style','popupmenu',...
+ 'Value',1,...
+ 'Tag','pop_scale');
+
+%% ---- DFA
+panel_DFA = uipanel(...
+ 'Parent',panel_HRV,...
+ 'Title','DFA',...
+ 'Tag','panel_DFA',...
+ 'UserData',[],...
+ 'Clipping','on',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'Position',[0.0323741007194245 0.028148148148148 0.942446043165468 0.21037037037037]);
+
+txt_minbox = uicontrol(...
+ 'Parent',panel_DFA,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.0193798449612403 0.73015873015873 0.151162790697675 0.134920634920635],...
+ 'String','Minbox',...
+ 'Style','text',...
+ 'Tag','txt_minbox');
+
+txt_maxbox = uicontrol(...
+ 'Parent',panel_DFA,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.387596899224806 0.73015873015873 0.162790697674419 0.134920634920635],...
+ 'String','Maxbox',...
+ 'Style','text',...
+ 'Tag','txt_maxbox');
+
+edit_minbox = uicontrol(...
+ 'Parent',panel_DFA,...
+ 'Units','normalized',...
+ 'BackgroundColor',[1 1 1],...
+ 'Position',[0.178294573643411 0.706349206349206 0.131782945736434 0.19047619047619],...
+ 'String','4',...
+ 'Style','edit',...
+ 'Value',4,...
+ 'Tag','edit_minbox');
+
+check_slidingwins = uicontrol(...
+ 'Parent',panel_DFA,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'Position',[0.0193798449612403 0.444444444444445 0.391472868217054 0.119047619047619],...
+ 'String','sliding windows',...
+ 'Style','checkbox',...
+ 'Value',1,...
+ 'Tag','check_slidingwins');
+
+push_ok_DFA = uicontrol(...
+ 'Parent',panel_DFA,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'Callback',@DFA_callback,...
+ 'Position',[0.383720930232558 0.134920634920635 0.205426356589147 0.19047619047619],...
+ 'String','ok',...
+ 'Tag','push_ok_DFA');
+
+edit_maxbox = uicontrol(...
+ 'Parent',panel_DFA,...
+ 'Units','normalized',...
+ 'BackgroundColor',[1 1 1],...
+ 'Position',[0.562015503875969 0.706349206349206 0.131782945736434 0.19047619047619],...
+ 'String','16',...
+ 'Style','edit',...
+ 'Value',16,...
+ 'Tag','edit_maxbox');
+
+%% Graphs
+panel_graphs = uipanel(...
+ 'Parent',main_figure,...
+ 'Title','Graphs',...
+ 'Tag','panel_graphs',...
+ 'Clipping','on',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'Position',[0.592666005946482 0.0115942028985507 0.397423191278494 0.972463768115942]);
+
+%% ---- IBIs
+edit_subjectname_IBIs = uicontrol(...
+ 'Parent',panel_graphs,...
+ 'Units','normalized',...
+ 'BackgroundColor',[1 1 1],...
+ 'Position',[0.71 0.933333333333333 0.27 0.0320610687022901],...
+ 'String',blanks(0),...
+ 'Style','edit',...
+ 'Tag','edit_subject_IBIs',...
+ 'CreateFcn',@update_subjectname_IBIs,...
+ 'Callback',@edit_subjectname_IBIs_callback);
+
+axes_IBIs = axes(...
+ 'Parent',panel_graphs,...
+ 'Position',[0.1 0.738931297709924 0.458438287153652 0.23969465648855],...
+ 'CameraPosition',[0.5 0.5 9.16025403784439],...
+ 'CameraPositionMode',get(0,'defaultaxesCameraPositionMode'),...
+ 'Color',get(0,'defaultaxesColor'),...
+ 'ColorOrder',get(0,'defaultaxesColorOrder'),...
+ 'FontSize',7,...
+ 'LooseInset',[0.13569492144684 0.125485436893204 0.0991616733649981 0.0855582524271844],...
+ 'XColor',get(0,'defaultaxesXColor'),...
+ 'YColor',get(0,'defaultaxesYColor'),...
+ 'YLim',get(0,'defaultaxesYLim'),...
+ 'YLimMode','auto',...
+ 'XLimMode','auto',...
+ 'ZColor',get(0,'defaultaxesZColor'),...
+ 'Tag','axes_IBIs',...
+ 'UserData',[],...
+ 'NextPlot','replacechildren',...
+ 'CreateFcn',@plot_IBIs,...
+ 'ButtonDownFcn',@buttondown_IBIs);
+
+push_dwnsub_IBIs = uicontrol(...
+ 'Parent',panel_graphs,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'Position',[0.57 0.933333333333333 0.052896725440806 0.0340740740740741],...
+ 'String','<',...
+ 'Tag','push_dwnsub_IBIs',...
+ 'Callback',@dwnsub_IBIs);
+
+push_upsub_IBIs = uicontrol(...
+ 'Parent',panel_graphs,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'Position',[0.63 0.933333333333333 0.052896725440806 0.0340740740740741],...
+ 'String','>',...
+ 'Tag','push_upsub_IBIs',...
+ 'Callback',@upsub_IBIs);
+
+txt_subject_IBIs = uicontrol(...
+ 'Parent',panel_graphs,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.795 0.97 0.100755667506297 0.0222222222222222],...
+ 'String','Subject',...
+ 'Style','text',...
+ 'Tag','txt_subject_IBIs');
+
+txt_info_IBIs = uicontrol(...
+ 'Parent',panel_graphs,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.58 0.77 0.4 0.125190839694657],...
+ 'String',[],...
+ 'Style','text',...
+ 'Tag','txt_info_IBIs',...
+ 'CreateFcn',@update_info_IBIs);
+
+%% ---- PCR
+edit_subjectname_PCR = uicontrol(...
+ 'Parent',panel_graphs,...
+ 'Units','normalized',...
+ 'BackgroundColor',[1 1 1],...
+ 'Position',[0.71 0.613333333333334 0.27 0.0320610687022901],...
+ 'String',blanks(0),...
+ 'Style','edit',...
+ 'Tag','edit_subject_PCR',...
+ 'CreateFcn',@update_subjectname_PCR,...
+ 'Callback',@edit_subjectname_PCR_callback);
+
+axes_PCR = axes(...
+ 'Parent',panel_graphs,...
+ 'Position',[0.1 0.40763358778626 0.458438287153652 0.23969465648855],...
+ 'CameraPosition',[0.5 0.5 9.16025403784439],...
+ 'CameraPositionMode',get(0,'defaultaxesCameraPositionMode'),...
+ 'Color',get(0,'defaultaxesColor'),...
+ 'ColorOrder',get(0,'defaultaxesColorOrder'),...
+ 'FontSize',7,...
+ 'LooseInset',[0.13569492144684 0.125485436893204 0.0991616733649981 0.0855582524271844],...
+ 'XColor',get(0,'defaultaxesXColor'),...
+ 'YColor',get(0,'defaultaxesYColor'),...
+ 'YLim',get(0,'defaultaxesYLim'),...
+ 'YLimMode','auto',...
+ 'XLimMode','auto',...
+ 'ZColor',get(0,'defaultaxesZColor'),...
+ 'Tag','axes_PCR',...
+ 'UserData',[],...
+ 'NextPlot','replacechildren',...
+ 'CreateFcn',@plot_PCR,...
+ 'ButtondownFcn',@buttondown_PCR);
+
+push_dwnsub_PCR = uicontrol(...
+ 'Parent',panel_graphs,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'Callback',@dwnsub_PCR,...
+ 'Position',[0.57 0.613333333333334 0.052896725440806 0.0340740740740741],...
+ 'String','<',...
+ 'Tag','push_dwnsub_PCR');
+
+push_upsub_PCR = uicontrol(...
+ 'Parent',panel_graphs,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'Callback',@upsub_PCR,...
+ 'Position',[0.63 0.613333333333334 0.052896725440806 0.0340740740740741],...
+ 'String','>',...
+ 'Tag','push_upsub_PCR');
+
+txt_subjectname_PCR = uicontrol(...
+ 'Parent',panel_graphs,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.795 0.65 0.100755667506297 0.0222222222222222],...
+ 'String','Subject',...
+ 'Style','text',...
+ 'Tag','txt_subject_PCR');
+
+txt_info_PCR = uicontrol(...
+ 'Parent',panel_graphs,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.58 0.44 0.4 0.125190839694657],...
+ 'String',[],...
+ 'Style','text',...
+ 'Tag','txt_info_PCR',...
+ 'CreateFcn',@update_info_PCR);
+
+%% ---- HRV
+edit_subjectname_HRV = uicontrol(...
+ 'Parent',panel_graphs,...
+ 'Units','normalized',...
+ 'BackgroundColor',[1 1 1],...
+ 'Position',[0.71 0.288 0.27 0.0320610687022901],...
+ 'String',blanks(0),...
+ 'Style','edit',...
+ 'Tag','edit_subject_HRV',...
+ 'CreateFcn',@update_subjectname_HRV,...
+ 'Callback',@edit_subjectname_HRV_callback);
+
+edit_condname_HRV = uicontrol(...
+ 'Parent',panel_graphs,...
+ 'Units','normalized',...
+ 'BackgroundColor',[1 1 1],...
+ 'Position',[0.71 0.22 0.27 0.0320610687022901],...
+ 'String',blanks(0),...
+ 'Style','edit',...
+ 'Tag','edit_condname_HRV',...
+ 'CreateFcn',@update_condname_HRV,...
+ 'Callback',@edit_condname_HRV_callback);
+
+axes_HRV = axes(...
+ 'Parent',panel_graphs,...
+ 'Position',[0.1 0.0763358778625954 0.458438287153652 0.23969465648855],...
+ 'CameraPosition',[0.5 0.5 9.16025403784439],...
+ 'CameraPositionMode',get(0,'defaultaxesCameraPositionMode'),...
+ 'Color',get(0,'defaultaxesColor'),...
+ 'ColorOrder',get(0,'defaultaxesColorOrder'),...
+ 'FontSize',7,...
+ 'LooseInset',[0.13569492144684 0.125485436893204 0.0991616733649981 0.0855582524271844],...
+ 'XColor',get(0,'defaultaxesXColor'),...
+ 'YColor',get(0,'defaultaxesYColor'),...
+ 'YLim',get(0,'defaultaxesYLim'),...
+ 'YLimMode','auto',...
+ 'XLimMode','auto',...
+ 'ZColor',get(0,'defaultaxesZColor'),...
+ 'Tag','axes_HRV',...
+ 'UserData',[],...
+ 'NextPlot','replacechildren',...
+ 'CreateFcn',@plot_HRV,...
+ 'ButtonDownFcn',@buttondown_HRV);
+
+txt_info2_HRV = uicontrol(...
+ 'Parent',panel_graphs,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.78 0.065 0.2 0.14],...
+ 'String',[],...
+ 'Style','text',...
+ 'Tag','txt_info2_HRV');
+
+txt_info1_HRV = uicontrol(...
+ 'Parent',panel_graphs,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.58 0.065 0.2 0.14],...
+ 'String',[],...
+ 'Style','text',...
+ 'Tag','txt_info1_HRV',...
+ 'CreateFcn',@update_info1_HRV);
+
+txt_condition_HRV = uicontrol(...
+ 'Parent',panel_graphs,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.787 0.252 0.18 0.0229007633587786],...
+ 'String','Condition',...
+ 'Style','text',...
+ 'Tag','txt_epoh_HRV');
+
+push_dwnsub_HRV = uicontrol(...
+ 'Parent',panel_graphs,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'Callback',@dwnsub_HRV,...
+ 'Position',[0.57 0.288549618320611 0.052896725440806 0.033587786259542],...
+ 'String','<',...
+ 'Tag','push_dwnsub_HRV');
+
+push_upsub_HRV = uicontrol(...
+ 'Parent',panel_graphs,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'Callback',@upsub_HRV,...
+ 'Position',[0.63 0.288549618320611 0.052896725440806 0.033587786259542],...
+ 'String','>',...
+ 'Tag','push_upsub_HRV');
+
+push_dwncond_HRV = uicontrol(...
+ 'Parent',panel_graphs,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'Callback',@dwncond_HRV,...
+ 'Position',[0.57 0.22 0.052896725440806 0.033587786259542],...
+ 'String','<',...
+ 'Tag','push_dwncond_HRV');
+
+push_upcond_HRV = uicontrol(...
+ 'Parent',panel_graphs,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'Callback',@upcond_HRV,...
+ 'Position',[0.63 0.22 0.052896725440806 0.033587786259542],...
+ 'String','>',...
+ 'Tag','push_upcond_HRV');
+
+txt_subject_HRV = uicontrol(...
+ 'Parent',panel_graphs,...
+ 'Units','normalized',...
+ 'BackgroundColor',[0.941176470588235 0.941176470588235 0.941176470588235],...
+ 'HorizontalAlignment','left',...
+ 'Position',[0.795 0.325 0.100755667506297 0.0222222222222222],...
+ 'String','Subject',...
+ 'Style','text',...
+ 'Tag','txt_subject_HRV');
+
+%% Toolbar
+toolbar = uitoolbar(...
+ 'Parent',main_figure,...
+ 'Tag','toolbar');
+
+toolsave = uipushtool(...
+ 'Parent',toolbar,...
+ 'ClickedCallback',@saveDATA_callback,...
+ 'CData',mat{1},...
+ 'TooltipString','Save Data',...
+ 'BusyAction','cancel',...
+ 'Interruptible','off',...
+ 'Tag','toolsave');
+
+toolexcel = uipushtool(...
+ 'Parent',toolbar,...
+ 'ClickedCallback',@excel_callback,...
+ 'CData',mat{2},...
+ 'TooltipString','Export to Excel',...
+ 'BusyAction','cancel',...
+ 'Interruptible','off',...
+ 'Tag','toolexcel');
+
+tooltutorial = uitoggletool(...
+ 'Parent',toolbar,...
+ 'ClickedCallback',@tutorial_callback,...
+ 'CData',mat{3},...
+ 'TooltipString','User''s Guide',...
+ 'Tag','tooltutorial');
+
+toolabout = uipushtool(...
+ 'Parent',toolbar,...
+ 'ClickedCallback',@about_callback,...
+ 'CData',mat{4},...
+ 'TooltipString','About',...
+ 'Tag','toolabout');
+
+%% ---------- GUI CALLBACKS -----------
+%% Plot KARDIA image
+ function plot_kardia(src,eventdata)
+ H=imread('kardia.jpg');
+ image(H)
+ showaxes('off')
+ end
+
+%% Load Callbacks
+%% ---- Load Data
+ function load_data_callback(src,eventdata)
+ % get variables
+ datavar=get(edit_datavar_data,'String');
+ chn=str2num(get(edit_channel_data,'String'));
+ unit=get(edit_unit_data,'Value');
+ format=get(edit_format_data,'Value');
+
+ % error message
+ if isempty(datavar)
+ errordlg('Insert variable name','Load Data')
+ return
+ end
+
+ % open getfile gui
+ [names, path] = uigetfile...
+ ('*.mat','Load matlab files',...
+ 'MultiSelect', 'on');
+
+ if path==0
+ return
+ end
+
+ % get data
+ if ischar(names) % case 1 subject
+ work=load([path names]); % load variable
+ point=find(names=='.');Subjects=names(1:point-1); % remove extension
+ if isfield(work,datavar)==0
+ errordlg('Variable does not exist','Load Data') % error message
+ return
+ end
+ data=eval(['work.' datavar]);
+ s=size(data); % transpose data matrix (channels=columns)
+ if s(1)size(data,2) % error message for wrong channel number
+ errordlg('Wrong channel number','Load Data')
+ return
+ end
+ data=data(:,chn); % get data
+
+ if unit==2 % case unit ms
+ data=data/1000;
+ end
+ if format==2 % case type IBIs
+ data=cumsum(data); % get R events
+ end
+ data=data';
+ Revents=data;
+ subjectsNum=1;
+ [IBIs,thp]=ecg_hp(data,'instantaneous'); % get heart period
+
+ elseif iscell(names) % case more than one subjects
+ l=size(names,2); % number of subjects
+ for i=1:l % loop subjects
+ name=names{i};
+ point=find(name=='.');
+ Subjects{i}=name(1:point-1); % write subject name
+ work=load([path names{i}]);
+ if isfield(work,datavar)==0
+ errordlg('Variable does not exist','Load Data') % error message
+ return
+ end
+ data=eval(['work.' datavar]);
+ s=size(data); % transpose data matrix (channels=columns)
+ if s(1)size(data,2) % error message for wrong channel number
+ errordlg('Wrong channel number','Load Data')
+ return
+ end
+ data=data(:,chn);
+ if unit==2 % case unit ms
+ data=data/1000;
+ end
+ if format==2 % case type IBIs
+ data=cumsum(data);
+ end
+ data=data'; % transpose data (1 row)
+ Revents{i}=data;
+ [hp,thp]=ecg_hp(data,'instantaneous'); % get heart period
+ IBIs{i}=hp;
+ subjectsNum=l; % number of subjects
+ end
+ end
+
+ % clear old variables
+ clearFcn
+
+ % output variable
+ DATA.Subjects=Subjects;
+ DATA.R_events=Revents;
+ DATA.IBIs=IBIs;
+ DATA.GUI.SubjectsNum=subjectsNum;
+ DATA.GUI.Subject2plot_IBIs=[];
+ DATA.Events(subjectsNum).Conditions=[];
+ DATA.Events(subjectsNum).Latencies=[];
+
+ % set subject events
+ set(pop_subject_events,'Value',1)
+
+ % clear graphs
+ update_subjectname_PCR(edit_subjectname_PCR,[]);
+ plot_PCR(axes_PCR,[]);
+ update_subjectname_HRV(edit_subjectname_HRV,[]);
+ update_condname_HRV(edit_condname_HRV,[]);
+ plot_HRV(axes_HRV,[]);
+
+ % update plot
+ plot_IBIs(axes_IBIs,[]);
+ update_subjectname_IBIs(edit_subjectname_IBIs,[]);
+
+ % update information
+ update_info_IBIs(txt_info_IBIs,[]);
+ update_info_PCR(txt_info_PCR,[]);
+
+ % update event selection
+ set(pop_subject_events,'String',Subjects)
+ end
+
+%% ---- Load Events
+ function load_events_callback(src,eventdata)
+ % get variables
+ subjects=DATA.Subjects;
+ subjectsNum=DATA.GUI.SubjectsNum;
+ sub=get(pop_subject_events,'Value');
+ latvar=get(edit_latvar_events,'String');
+ codesvar=get(edit_condvar_events,'String');
+ unit=get(pop_unit_events,'Value');
+
+ if isempty(subjects) % error when no subjects imported
+ errordlg('Load subject data first','Load Events')
+ return
+ end
+ if isempty(latvar) % error when no latency variable
+ errordlg('Insert latency variable','Load Events')
+ return
+ end
+ if isempty(codesvar) % error when no conditions variable
+ errordlg('Insert conditions variable','Load Events')
+ return
+ end
+
+ % if we are using common eventfile
+ if DATA.GUI.UseCommonEventfile==1;
+ errordlg(['To load individual event files you' ...
+ ' need to load subjects again'],...
+ 'Load Events');
+ return
+ end
+
+ % load event data
+ [name, path] = uigetfile...
+ ('*.mat','Load matlab file containing events',...
+ 'MultiSelect', 'off');
+
+ if path==0
+ return
+ end
+
+ work=load([path name]);
+
+ % error message
+ if isfield(work,codesvar)==0
+ errordlg('Latency variable does not exist','Load Events')
+ return
+ end
+ if isfield(work,latvar)==0
+ errordlg('Conditions variable does not exist','Load Events')
+ return
+ end
+
+ % get latencies and codes
+ lats=eval(['work.' latvar]);
+ evs=eval(['work.' codesvar]);
+ if length(lats) ~= length (evs)
+ errordlg('Not same number of events and codes','Load Events');
+ return
+ end
+ DATA.GUI.EventsNum=length(lats);
+
+ % transpose (one row)
+ if size(evs,1)>size(evs,2)
+ evs=evs';
+ end
+ if size(lats,1)>size(lats,2)
+ lats=lats';
+ end
+
+ % transform to seconds
+ if unit==2
+ lats=lats/1000;
+ end
+
+ % create event matrix
+ N=length(evs);
+ events={evs{1}}; % get first event
+ % find all different events
+ if N>1
+ for i=2:N
+ if strcmp(evs{i},evs(1:i-1))==0
+ events=[events {evs{i}}];
+ end
+ end
+ end
+
+ % check consistency of conditions across subjects
+ events=sort(events);
+ if isempty(DATA.Conditions) % first eventfile
+ DATA.Conditions=events;
+ DATA.Events(sub).Conditions=evs;
+ DATA.Events(sub).Latencies=lats;
+ DATA.GUI.Eventfiles=1;
+ DATA.GUI.ConditionsNum=length(events);
+ else
+ if length(events)~=length(DATA.Conditions)
+ errordlg('Conditions not consistent across subjects',...
+ 'Load Events')
+ return
+ end
+ % write events structure for subject
+ if strcmp(events,DATA.Conditions)==1
+ if isempty(DATA.Events(sub).Conditions)
+ DATA.Events(sub).Conditions=evs;
+ DATA.Events(sub).Latencies=lats;
+ DATA.GUI.Eventfiles=DATA.GUI.Eventfiles+1;
+ else
+ quest = questdlg(...
+ 'Eventfile already exists. Do you want to replace it?',...
+ 'Load Events');
+ switch quest
+ case 'Yes'
+ DATA.Events(sub).Conditions=evs;
+ DATA.Events(sub).Latencies=lats;
+ case 'No'
+ return
+ end
+ end
+ else
+ errordlg('Conditions not consistent across subjects',...
+ 'Load Events')
+ return
+ end
+ end
+
+ % update information
+ update_info_IBIs(txt_info_IBIs,[]);
+ end
+
+%% Analysis Callbacks
+%% ---- PCR
+% -------------- Select Conditions GUI
+ function PCR_conditions_callback(src,eventdata)
+ % error when no imported event types are found
+ if isempty(DATA.Conditions)
+ errordlg('No conditions found','PCR')
+ return
+ end
+
+ % GUI
+ PCR_Conditions_Figure = figure(...
+ 'MenuBar','none',...
+ 'Units','characters',...
+ 'Color',[0.87843137254902 0.874509803921569 0.890196078431373],...
+ 'Colormap',[0 0 0.5625;0 0 0.625;0 0 0.6875;0 0 0.75;0 0 0.8125;0 0 0.875;0 0 0.9375;0 0 1;0 0.0625 1;0 0.125 1;0 0.1875 1;0 0.25 1;0 0.3125 1;0 0.375 1;0 0.4375 1;0 0.5 1;0 0.5625 1;0 0.625 1;0 0.6875 1;0 0.75 1;0 0.8125 1;0 0.875 1;0 0.9375 1;0 1 1;0.0625 1 1;0.125 1 0.9375;0.1875 1 0.875;0.25 1 0.8125;0.3125 1 0.75;0.375 1 0.6875;0.4375 1 0.625;0.5 1 0.5625;0.5625 1 0.5;0.625 1 0.4375;0.6875 1 0.375;0.75 1 0.3125;0.8125 1 0.25;0.875 1 0.1875;0.9375 1 0.125;1 1 0.0625;1 1 0;1 0.9375 0;1 0.875 0;1 0.8125 0;1 0.75 0;1 0.6875 0;1 0.625 0;1 0.5625 0;1 0.5 0;1 0.4375 0;1 0.375 0;1 0.3125 0;1 0.25 0;1 0.1875 0;1 0.125 0;1 0.0625 0;1 0 0;0.9375 0 0;0.875 0 0;0.8125 0 0;0.75 0 0;0.6875 0 0;0.625 0 0;0.5625 0 0],...
+ 'Name','Select Conditions',...
+ 'NumberTitle','off',...
+ 'Position',[100 30 50 15],...
+ 'Resize','Off');
+
+ list_conditions_PCR = uicontrol(...
+ PCR_Conditions_Figure,...
+ 'Style','listbox',...
+ 'String',DATA.Conditions,...
+ 'max',2,...
+ 'Units','normalize',...
+ 'Position',[.15 .2 .7 .7],...
+ 'BackgroundColor','w',...
+ 'ForegroundColor','k',...
+ 'Value',1);
+
+ push_ok_conditions_PCR = uicontrol(...
+ PCR_Conditions_Figure,...
+ 'Style','pushbutton',...
+ 'String','ok',...
+ 'Units','normalize',...
+ 'Position',[.25 .03 .2 .1],...
+ 'callback', @select_conditions_PCR_callback);
+
+ push_cancel_conditions_PCR = uicontrol(...
+ PCR_Conditions_Figure,...
+ 'Style','pushbutton',...
+ 'String','Cancel',...
+ 'Units','normalize',...
+ 'Position',[.55 .03 .2 .1],...
+ 'callback', @cancel_conditions_PCR_callback);
+
+ % Callbacks
+ function select_conditions_PCR_callback(src,eventdata)
+ % get condition indexes
+ ind=get(list_conditions_PCR,'Value');
+
+ % error message
+ if isempty (ind)
+ errordlg('No conditions selected','Select Conditions')
+ return
+ end
+
+ % clear previous results
+ DATA.GUI.PCRconditions=[];
+ DATA.GUI.PCRconditionsNum=[];
+
+ % update DATA structure
+ DATA.GUI.PCRconditionsNum=length(ind);
+ DATA.GUI.PCRconditions=DATA.Conditions(ind);
+
+ % update information
+ update_info_PCR(txt_info_PCR,[]);
+
+ delete(PCR_Conditions_Figure)
+ return
+ end
+
+ function cancel_conditions_PCR_callback(src,eventdata)
+ delete(PCR_Conditions_Figure)
+ end
+ end
+
+ function PCR_callback(src,eventdata)
+ % get variables
+ epochstart=str2num(get(edit_epochstart_PCR,'String'));
+ epochend=str2num(get(edit_epochend_PCR,'String'));
+ algorithm=get(pop_algorithm_PCR,'Value');
+ unit=get(pop_unit_PCR,'String');
+ unitvalue=get(pop_unit_PCR,'Value');
+ unit=unit{unitvalue};
+ window=str2num(get(edit_timewindow_PCR,'String'));
+ baseline=get(check_removebsl_PCR,'Value');
+ subs=DATA.GUI.SubjectsNum;
+ SelectedConds=DATA.GUI.PCRconditions;
+
+ % pass variables to DATA structure
+ DATA.GUI.PCR_EpochStart=mat2str(epochstart);
+ DATA.GUI.PCR_EpochEnd=mat2str(epochend);
+ switch algorithm
+ case 1
+ DATA.GUI.PCR_Algorithm='mean';
+ case 2
+ DATA.GUI.PCR_Algorithm='CDR';
+ DATA.GUI.PCR_EpochStart=mat2str(-15);
+ DATA.GUI.PCR_EpochEnd=mat2str(80);
+ case 3
+ DATA.GUI.PCR_Algorithm='constant';
+ case 4
+ DATA.GUI.PCR_Algorithm='linear';
+ case 5
+ DATA.GUI.PCR_Algorithm='spline';
+ end
+ DATA.GUI.PCR_TimeWindow=mat2str(window);
+ DATA.GUI.PCR_Unit=unit;
+
+ % error messages
+ if isempty (epochstart) && ...
+ algorithm~=2
+ errordlg('Define epoch limits','PCR')
+ return
+ end
+ if isempty (epochend) && ...
+ algorithm~=2
+ errordlg('Define epoch limits','PCR')
+ return
+ end
+ if isempty(DATA.GUI.PCRconditions)
+ errordlg ('Select conditions first','PCR')
+ return
+ end
+
+ % clear previous results
+ DATA.PCR=[];
+ DATA.PCR_GrandAverage=[];
+
+ % use the same eventfile (first subject) for all subjects
+ if DATA.GUI.SubjectsNum>1 && ...
+ DATA.GUI.Eventfiles1 % average only when more than
+ % one epochs
+ HR_mean=mean(HR);
+ else
+ HR_mean=HR;
+ end
+ HRbsl=mean(BSL);
+ end
+
+ % save results structure
+ DATA.PCR(i).(SelectedConds{j}).BSL=HRbsl;
+ DATA.PCR(i).(SelectedConds{j}).HR=HR_mean;
+ DATA.GUI.PCRepochs(i).(SelectedConds{j})=k;
+ end
+ end
+
+ % create grand average and data matrix structure
+ datamatrix=[];
+ for j=1:DATA.GUI.PCRconditionsNum
+ baseline=[];
+ hr=[];
+ for i=1:subs
+ baseline=[baseline DATA.PCR(1,i).(SelectedConds{j}).BSL];
+ hr=[hr; DATA.PCR(1,i).(SelectedConds{j}).HR];
+ end
+ dmatrix=[baseline; hr']; % data matrix for one condition
+ datamatrix=[datamatrix dmatrix]; % data matrix for all conditions
+ if subs>1
+ hr=mean(hr);
+ end
+ baseline=mean(baseline);
+ DATA.PCR_GrandAverage.(SelectedConds{j}).BSL=baseline;
+ DATA.PCR_GrandAverage.(SelectedConds{j}).HR=hr;
+ end
+ DATA.GUI.PCRdatamatrix=datamatrix;
+
+ % update plot
+ plot_PCR(axes_PCR,[]);
+ update_subjectname_PCR(edit_subjectname_PCR,[]);
+
+ % update information
+ update_info_PCR(txt_info_PCR,[]);
+ end
+
+%% ---- HRV
+%% -------- Epoch Data
+ function HRV_conditions_callback(src,eventdata)
+ % error when no imported event types are found
+ if isempty(DATA.Conditions)
+ errordlg('No conditions found','Epoch Data')
+ return
+ end
+
+ % GUI
+ HRV_Conditions_Figure = figure(...
+ 'MenuBar','none',...
+ 'Units','characters',...
+ 'Color',[0.87843137254902 0.874509803921569 0.890196078431373],...
+ 'Colormap',[0 0 0.5625;0 0 0.625;0 0 0.6875;0 0 0.75;0 0 0.8125;0 0 0.875;0 0 0.9375;0 0 1;0 0.0625 1;0 0.125 1;0 0.1875 1;0 0.25 1;0 0.3125 1;0 0.375 1;0 0.4375 1;0 0.5 1;0 0.5625 1;0 0.625 1;0 0.6875 1;0 0.75 1;0 0.8125 1;0 0.875 1;0 0.9375 1;0 1 1;0.0625 1 1;0.125 1 0.9375;0.1875 1 0.875;0.25 1 0.8125;0.3125 1 0.75;0.375 1 0.6875;0.4375 1 0.625;0.5 1 0.5625;0.5625 1 0.5;0.625 1 0.4375;0.6875 1 0.375;0.75 1 0.3125;0.8125 1 0.25;0.875 1 0.1875;0.9375 1 0.125;1 1 0.0625;1 1 0;1 0.9375 0;1 0.875 0;1 0.8125 0;1 0.75 0;1 0.6875 0;1 0.625 0;1 0.5625 0;1 0.5 0;1 0.4375 0;1 0.375 0;1 0.3125 0;1 0.25 0;1 0.1875 0;1 0.125 0;1 0.0625 0;1 0 0;0.9375 0 0;0.875 0 0;0.8125 0 0;0.75 0 0;0.6875 0 0;0.625 0 0;0.5625 0 0],...
+ 'Name','Select Conditions',...
+ 'NumberTitle','off',...
+ 'Position',[100 30 50 15],...
+ 'Resize','Off');
+
+ list_conditions_HRV = uicontrol(...
+ HRV_Conditions_Figure,...
+ 'Style','listbox',...
+ 'String',DATA.Conditions,...
+ 'max',2,...
+ 'Units','normalize',...
+ 'Position',[.15 .2 .7 .7],...
+ 'BackgroundColor','w',...
+ 'ForegroundColor','k',...
+ 'Value',1);
+
+ push_ok_conditions_HRV = uicontrol(...
+ HRV_Conditions_Figure,...
+ 'Style','pushbutton',...
+ 'String','ok',...
+ 'Units','normalize',...
+ 'Position',[.25 .03 .2 .1],...
+ 'callback', @select_conditions_HRV_callback);
+
+ push_cancel_conditions_HRV = uicontrol(...
+ HRV_Conditions_Figure,...
+ 'Style','pushbutton',...
+ 'String','Cancel',...
+ 'Units','normalize',...
+ 'Position',[.55 .03 .2 .1],...
+ 'callback', @cancel_conditions_HRV_callback);
+
+ % Callbacks
+ function select_conditions_HRV_callback(src,eventdata)
+ % get condition indexes
+ ind=get(list_conditions_HRV,'Value');
+
+ % error message
+ if isempty (ind)
+ errordlg('No conditions selected','Select Conditions')
+ return
+ end
+
+ % clear previous results
+ DATA.GUI.HRVconditions=[];
+ DATA.GUI.HRVconditionsNum=[];
+
+ % update DATA structure
+ DATA.GUI.HRVconditionsNum=length(ind);
+ DATA.GUI.HRVconditions=DATA.Conditions(ind);
+
+ % update information
+ DATA.GUI.HRV2plot='Epochs';
+ update_info1_HRV(txt_info1_HRV,[]);
+
+ delete(HRV_Conditions_Figure)
+ return
+ end
+
+ function cancel_conditions_HRV_callback(src,eventdata)
+ delete(HRV_Conditions_Figure)
+ end
+ end
+
+ function epochdata_callback(src,eventdata)
+ % get variables
+ epochstart=str2num(get(edit_epochstart_HRV,'String'));
+ epochend=str2num(get(edit_epochend_HRV,'String'));
+ subs=DATA.GUI.SubjectsNum;
+ SelectedConds=DATA.GUI.HRVconditions;
+
+ % pass variables to DATA structure
+ DATA.GUI.HRV_EpochStart=mat2str(epochstart);
+ DATA.GUI.HRV_EpochEnd=mat2str(epochend);
+
+ % error messages
+ if isempty (epochstart)
+ errordlg('Define epoch limits','HRV')
+ return
+ end
+ if isempty (epochend)
+ errordlg('Define epoch limits','HRV')
+ return
+ end
+ if isempty(DATA.GUI.HRVconditions)
+ errordlg ('Select conditions first','HRV')
+ return
+ end
+
+ % clear previous results
+ DATA.Epochs=[];
+
+ % use the same eventfile (first subject) for all subjects
+ if DATA.GUI.SubjectsNum>1 && ...
+ DATA.GUI.Eventfiles1
+ errordlg (['HRV conditions should not have more ' ...
+ 'than 1 epoch'],'HRV');
+ DATA.GUI.HRVconditions=[];
+ DATA.GUI.HRVconditionsNum=[];
+ return
+ end
+
+ % find data within analysis window
+ ind=(lat+epochstart30
+ errordlg('Choose a smaller model order','Spectral Analysis')
+ return
+ end
+ DATA.GUI.Spectral_ARorder=ARorder';
+
+ % error messages
+ if isempty (DATA.Epochs)
+ errordlg('Define epochs first','Spectral Analysis')
+ return
+ end
+
+ % clear previous results
+ DATA.HRV.Spectral=[];
+
+ for i=1:subs % get subject data
+ % get necessary variables
+ data=DATA.Epochs(i);
+
+ for j=1:DATA.GUI.HRVconditionsNum % get condition
+ hp=data.(SelectedConds{j}).hp;
+
+ % get stats
+ avIBI=mean(hp*1000);
+ maxIBI=max(hp*1000);
+ minIBI=min(hp*1000);
+ RMS=RMSSD(hp*1000);
+ SDNN=std(hp*1000);
+
+ hp=hp*1000;
+ thp=data.(SelectedConds{j}).thp;
+
+ % spline interpolation
+ auxtime = thp(1):1/fs:thp(end);
+ hp2=(spline(thp,hp,auxtime))';
+
+ % detrend hp
+ switch detrendmethod
+ case 1
+ hp3=detrend(hp2,'constant');
+ DATA.GUI.Spectral_DetrendMethod='constant';
+ case 2
+ hp3=detrend(hp2,'linear');
+ DATA.GUI.Spectral_DetrendMethod='linear';
+ end
+
+ % Filter method
+ switch Filter
+ case 1
+ wdw=hanning(length(hp3));
+ DATA.GUI.Spectral_Filter='hanning';
+ case 2
+ wdw=hamming(length(hp3));
+ DATA.GUI.Spectral_Filter='hamming';
+ case 3
+ wdw=blackman(length(hp3));
+ DATA.GUI.Spectral_Filter='blackman';
+ case 4
+ wdw=bartlett(length(hp3));
+ DATA.GUI.Spectral_Filter='bartlett';
+ end
+
+ hp4=hp3.*wdw;
+
+ % Calculate FFT points
+ switch points
+ case 1
+ N=512;
+ DATA.GUI.Spectral_Points='512';
+ case 2
+ N=1024;
+ DATA.GUI.Spectral_Points='1024';
+ case 3
+ N=2^nextpow2(length(hp));
+ DATA.GUI.Spectral_Points=[int2str(N) ' (auto)'];
+ end
+
+ switch algorithm
+ case 1 % FFT
+ cw = (1/N) * sum(wdw.^2); % Coefficient to remove window effect
+ PSD=(abs(fft(hp4,N)).^2)/(N*fs*cw);
+ F=(0:fs/N:fs-fs/N)';
+ PSD=2*PSD(1:ceil(length(PSD)/2));
+ F=F(1:ceil(length(F)/2));
+ DATA.GUI.Spectral_Algorithm='FFT';
+
+ case 2 % AR model
+ [A, variance] = arburg(hp4,ARorder);
+ [H,F] = freqz(sqrt(variance),A,N/2,fs);
+ cw = (1/length(hp4)) * sum(wdw.^2); % Coefficient to remove the window effect
+ PSD= 2*(abs(H).^2)/(fs*cw);
+ DATA.GUI.Spectral_Algorithm='AR model';
+ end
+
+ % get power in different bands
+ hf=spPCRower(F,PSD,'hf');
+ lf=spPCRower(F,PSD,'lf');
+ vlf=spPCRower(F,PSD,'vlf');
+ nhf=spPCRower(F,PSD,'nhf');
+ nlf=spPCRower(F,PSD,'nlf');
+
+ % save results structure
+ DATA.HRV.Spectral(i).(SelectedConds{j}).PSD=PSD;
+ DATA.HRV.Spectral(i).(SelectedConds{j}).F=F;
+ DATA.HRV.Spectral(i).(SelectedConds{j}).HF=hf;
+ DATA.HRV.Spectral(i).(SelectedConds{j}).LF=lf;
+ DATA.HRV.Spectral(i).(SelectedConds{j}).VLF=vlf;
+ DATA.HRV.Spectral(i).(SelectedConds{j}).NHF=nhf;
+ DATA.HRV.Spectral(i).(SelectedConds{j}).NLF=nlf;
+ DATA.HRV.Spectral(i).(SelectedConds{j}).avIBI=avIBI;
+ DATA.HRV.Spectral(i).(SelectedConds{j}).maxIBI=maxIBI;
+ DATA.HRV.Spectral(i).(SelectedConds{j}).minIBI=minIBI;
+ DATA.HRV.Spectral(i).(SelectedConds{j}).RMSSD=RMS;
+ DATA.HRV.Spectral(i).(SelectedConds{j}).SDNN=SDNN;
+ end
+ end
+
+ % update GUI structure
+ DATA.GUI.HRV2plot='Spectral';
+
+ % update plot
+ plot_HRV(axes_HRV,[]);
+ update_subjectname_HRV(edit_subjectname_HRV,[]);
+ update_condname_HRV(edit_condname_HRV,[]);
+
+ % update information
+ update_info1_HRV(txt_info1_HRV,[]);
+ end
+
+%% -------- DFA
+ function DFA_callback(src,eventdata)
+ % get variables
+ minbox=str2num(get(edit_minbox,'String'));
+ maxbox=str2num(get(edit_maxbox,'String'));
+ sliding=get(check_slidingwins,'Value');
+ subs=DATA.GUI.SubjectsNum;
+ SelectedConds=DATA.GUI.HRVconditions;
+
+ % error messages
+ if isempty (DATA.Epochs)
+ errordlg('Define epochs first','DFA')
+ return
+ end
+
+ % box size restrictions
+ if ~isint(minbox) || ~isint(maxbox)
+ errordlg('Box sizes must be integers','DFA')
+ return
+ end
+
+ if minbox<4
+ errordlg('Minimum box size is 4','DFA')
+ return
+ end
+
+ % clear previous results
+ DATA.HRV.DFA=[];
+
+ for i=1:subs % get subject data
+ % get necessary variables
+ data=DATA.Epochs(i);
+
+ for j=1:DATA.GUI.HRVconditionsNum % get condition
+ hp=data.(SelectedConds{j}).hp;
+
+ % get stats
+ avIBI=mean(hp*1000);
+ maxIBI=max(hp*1000);
+ minIBI=min(hp*1000);
+ RMS=RMSSD(hp*1000);
+ SDNN=std(hp*1000);
+
+ switch sliding
+ case 1 % Use Sliding Windows
+ [a,n,Fn]=DFA(hp,minbox,maxbox,'s',0);
+ DATA.GUI.DFA_sliding='Yes';
+ case 0 % Non sliding windows
+ [a,n,Fn]=DFA(hp,minbox,maxbox,0,0);
+ DATA.GUI.DFA_sliding='No';
+ end
+
+ % save results structure
+ DATA.HRV.DFA(i).(SelectedConds{j}).a=a;
+ DATA.HRV.DFA(i).(SelectedConds{j}).n=n;
+ DATA.HRV.DFA(i).(SelectedConds{j}).Fn=Fn;
+ DATA.HRV.DFA(i).(SelectedConds{j}).avIBI=avIBI;
+ DATA.HRV.DFA(i).(SelectedConds{j}).maxIBI=maxIBI;
+ DATA.HRV.DFA(i).(SelectedConds{j}).minIBI=minIBI;
+ DATA.HRV.DFA(i).(SelectedConds{j}).RMSSD=RMS;
+ DATA.HRV.DFA(i).(SelectedConds{j}).SDNN=SDNN;
+ end
+ end
+
+ % update GUI structure
+ DATA.GUI.HRV2plot='DFA';
+ DATA.GUI.DFA_minbox=mat2str(minbox);
+ DATA.GUI.DFA_maxbox=mat2str(maxbox);
+
+ % update plot
+ plot_HRV(axes_HRV,[]);
+ update_subjectname_HRV(edit_subjectname_HRV,[]);
+ update_condname_HRV(edit_condname_HRV,[]);
+
+ % update information
+ update_info1_HRV(txt_info1_HRV,[]);
+ end
+
+%% Ploting Callbacks
+%% ---- IBIs
+ function plot_IBIs(src,eventdata)
+ % get variables
+ data=DATA.IBIs;
+ sub=DATA.GUI.Subject2plot_IBIs;
+ subjects=DATA.Subjects;
+
+ % set axes
+ axes(src)
+ title('Interbeat Intervals','Fontsize',8)
+ xlabel('Beats','Fontsize',8)
+ ylabel('Time (sec)','Fontsize',8)
+
+ % return when no data exists
+ if isempty(data)
+ return
+ end
+
+ % plot
+ if isempty(sub) || sub==0 % plot all subjects
+ s=DATA.GUI.SubjectsNum;
+ if s>1 % more than 1 subject
+ for i=1:s
+ plot(data{1,i})
+ hold all
+ end
+ set(src,'NextPlot','replacechildren')
+ else % 1 subject
+ plot(data)
+ end
+ elseif sub>0 % plot individual subjects
+ s=size(data,2);
+ if s>1
+ plot(data{1,sub}) % more than 1 subject
+ else
+ plot(data) % 1 subject
+ end
+ end
+
+ %update
+ update_subjectname_IBIs(edit_subjectname_IBIs,[]);
+ end
+
+%% ---- PCR
+ function plot_PCR(src,eventdata)
+ % get variables
+ data=DATA.PCR;
+ sub=DATA.GUI.Subject2plot_PCR;
+ check=get(check_removebsl_PCR,'Value');
+ window=str2num(get(edit_timewindow_PCR,'String'));
+ algorithm=get(pop_algorithm_PCR,'Value');
+ unit=DATA.GUI.PCR_Unit;
+
+ % set axes
+ axes(src)
+ title('Phasic Cardiac Responses','Fontsize',8)
+ xlabel('Time (sec)','Fontsize',8)
+ ylabel(['Cardiac Response (' unit ')'],'Fontsize',8)
+
+ % return when no data exists
+ if isempty(data)
+ return
+ end
+
+ % plot
+ if isempty(sub) || sub==0 % plot grand average
+ data=DATA.PCR_GrandAverage;
+ for i=1:DATA.GUI.PCRconditionsNum % get condition
+ cond=DATA.GUI.PCRconditions{i};
+ l=length(data.(cond).HR);
+
+ % create axes
+ yy=[data.(cond).BSL data.(cond).HR];
+ switch algorithm
+ case 2
+ xx=[0 2 5 9 14 20 27 34 44 57 70]; % CDR time line
+ case 1
+ xx=[0 (1:l)];xx=xx.*window;
+ case {3,4,5}
+ yy=data.(cond).HR;
+ xx=[0 (1:l-1)];xx=xx.*window;
+ end
+
+ % remove baseline
+ if check==1
+ yy=yy-data.(cond).BSL;
+ end
+
+ % plot
+ plot(xx,yy)
+ hold all
+ end
+ set(src,'NextPlot','replacechildren')
+
+ elseif sub>0 % plot individual subjects
+ data=DATA.PCR;
+ s=size(data,2);
+ for i=1:DATA.GUI.PCRconditionsNum % get condition
+ cond=DATA.GUI.PCRconditions{i};
+ l=length(data(1).(cond).HR);
+ % create axes
+ if s>1
+ yy=[data(1,sub).(cond).BSL data(1,sub).(cond).HR];
+ else
+ yy=[data.(cond).BSL data.(cond).HR];
+ end
+ if algorithm==2
+ xx=[0 2 5 9 14 20 27 34 44 57 70]; % CDR time line
+ else
+ xx=[0 (1:l)];xx=xx.*window;
+ end
+
+ % remove baseline
+ if check==1
+ yy=yy-yy(1);
+ end
+ % plot
+ plot(xx,yy)
+ hold all
+ end
+ set(src,'NextPlot','replacechildren')
+ end
+
+ %update
+ update_subjectname_PCR(edit_subjectname_PCR,[]);
+ end
+
+%% ---- HRV
+ function plot_HRV(src,eventdata)
+ % get variables
+ sub=DATA.GUI.Subject2plot_HRV;
+ graph=DATA.GUI.HRV2plot;
+ cond=DATA.GUI.Cond2plot_HRV;
+ conditions=DATA.GUI.HRVconditions;
+ scale=DATA.GUI.Spectral_Scale;
+ axes(src)
+
+ % return when no data is found
+ if isempty(graph)
+ % set axes
+ cla
+ title('Heart Rate Variability','Fontsize',8)
+ return
+ end
+
+ if isempty(sub)
+ sub=1;
+ end
+ if isempty(cond)
+ cond=1;
+ end
+ condname=conditions{cond};
+
+ switch graph
+ case 'Epochs'
+ data=DATA.Epochs;
+
+ % create axes
+ yy=data(sub).(condname).hp;
+
+ % plot
+ plot(yy)
+
+ % set axes
+ title('HRV Epochs','Fontsize',8)
+ ylabel('Time (sec)','Fontsize',8)
+ xlabel('Beats','Fontsize',8)
+
+ case 'Spectral'
+ data=DATA.HRV.Spectral;
+
+ % create axes
+ yy=data(sub).(condname).PSD;
+ xx=data(sub).(condname).F;
+
+ % plot
+ switch scale
+ case 'normal'
+ plot(xx,yy)
+ case 'log'
+ loglog(xx,yy)
+ case 'semilog'
+ semilogy(xx,yy)
+ end
+
+ % set axes
+ title('Spectral Graph','Fontsize',8)
+ xlabel('Frequency (Hz)','Fontsize',8)
+ ylabel('PSD (ms^2/Hz)','Fontsize',8)
+
+ case 'DFA'
+ data=DATA.HRV.DFA;
+
+ % create axes
+ yy=data(sub).(condname).Fn;
+ xx=data(sub).(condname).n;
+
+ %plot
+ plot(log10(xx),log10(yy))
+
+ % create axes
+ title('Detrended Fluctuation Analysis','Fontsize',8)
+ xlabel('log(n)','Fontsize',8)
+ ylabel('log(Fn)','Fontsize',8)
+ end
+
+ %update
+ DATA.GUI.Cond2plot_HRV=cond;
+ update_subjectname_HRV(edit_subjectname_HRV,[]);
+ update_condname_HRV(edit_condname_HRV,[]);
+ end
+
+%% Update Graph Callbacks
+%% ---- IBIs
+ function dwnsub_IBIs(src,eventdata)
+ % get data
+ sub=DATA.GUI.Subject2plot_IBIs;
+
+ % change subject to plot
+ if ~isempty(sub) && sub>0
+ sub=sub-1;
+ end
+ DATA.GUI.Subject2plot_IBIs=sub;
+
+ % update plot
+ plot_IBIs(axes_IBIs,[]);
+ update_subjectname_IBIs(edit_subjectname_IBIs,[]);
+ end
+
+ function upsub_IBIs(src,eventdata)
+ % get data
+ sub=DATA.GUI.Subject2plot_IBIs;
+
+ % change subject to plot
+ if isempty(sub)
+ sub=1;
+ elseif sub1
+ set (src,'String','all')
+ else
+ set (src,'String',subjects)
+ end
+ else
+ if subjectsNum>1 % plot individual subjects
+ set (src,'String',subjects{sub})
+ else
+ set (src,'String',subjects)
+ end
+ end
+ end
+
+ function edit_subjectname_IBIs_callback(src,eventdata)
+ % get variables
+ subjectsNum=DATA.GUI.SubjectsNum;
+ subjects=DATA.Subjects;
+ subjectname=get(edit_subjectname_IBIs,'String');
+
+ % find subject to plot
+ comp=strcmp(subjects,subjectname);
+ sub=find(comp==1);
+ if sub==0
+ sub=[];
+ end
+
+ % update
+ DATA.GUI.Subject2plot_IBIs=sub;
+ plot_IBIs(axes_IBIs,[]);
+ end
+
+ function update_info_IBIs(src,eventdata)
+ set(src,'String',{...
+ ['Subjects: ' int2str(DATA.GUI.SubjectsNum)];...
+ ['Eventfiles: ' int2str(DATA.GUI.Eventfiles)];...
+ ['Conditions: ' int2str(DATA.GUI.ConditionsNum)]});
+ end
+
+%% ---- PCR
+ function dwnsub_PCR(src,eventdata)
+ % get data
+ sub=DATA.GUI.Subject2plot_PCR;
+
+ % change subject to plot
+ if ~isempty(sub) && sub>0
+ sub=sub-1;
+ end
+ DATA.GUI.Subject2plot_PCR=sub;
+
+ % update plot
+ plot_PCR(axes_PCR,[]);
+ update_subjectname_PCR(edit_subjectname_PCR,[]);
+ end
+
+ function upsub_PCR(src,eventdata)
+ % get data
+ sub=DATA.GUI.Subject2plot_PCR;
+
+ % change subject to plot
+ if isempty(sub)
+ sub=1;
+ elseif sub1
+ set (src,'String','all')
+ else
+ set (src,'String',subjects)
+ end
+ else
+ if subjectsNum>1 % plot individual subjects
+ set (src,'String',subjects{sub})
+ else
+ set (src,'String',subjects)
+ end
+ end
+
+ end
+
+ function edit_subjectname_PCR_callback(src,eventdata)
+ % get variables
+ subjectsNum=DATA.GUI.SubjectsNum;
+ subjects=DATA.Subjects;
+ subjectname=get(edit_subjectname_PCR,'String');
+
+ % find subject to plot
+ comp=strcmp(subjects,subjectname);
+ sub=find(comp==1);
+ if sub==0
+ sub=[];
+ end
+
+ % update
+ DATA.GUI.Subject2plot_PCR=sub;
+ plot_PCR(axes_PCR,[]);
+ end
+
+ function update_info_PCR(src,eventdata)
+ set(src,'String',{...
+ ['Conditions: ' int2str(DATA.GUI.PCRconditionsNum)];...
+ ['Epoch Start: ' DATA.GUI.PCR_EpochStart];...
+ ['Epoch End: ' DATA.GUI.PCR_EpochEnd];...
+ ['Algorithm: ' DATA.GUI.PCR_Algorithm];...
+ ['Time Window: ' DATA.GUI.PCR_TimeWindow]});
+ end
+
+%% ---- HRV
+ function dwnsub_HRV(src,eventdata)
+ % get data
+ sub=DATA.GUI.Subject2plot_HRV;
+
+ % change subject to plot
+ if isempty(sub)
+ sub=1;
+ end
+ if sub>1
+ sub=sub-1;
+ end
+ DATA.GUI.Subject2plot_HRV=sub;
+
+ % update
+ plot_HRV(axes_HRV,[]);
+ update_subjectname_HRV(edit_subjectname_HRV,[]);
+ update_info1_HRV(txt_info1_HRV,[])
+ end
+
+ function upsub_HRV(src,eventdata)
+ % get data
+ sub=DATA.GUI.Subject2plot_HRV;
+
+ % change subject to plot
+ if isempty(sub)
+ sub=1;
+ end
+ if sub1
+ set (src,'String',subjects{sub})
+ else
+ set (src,'String',subjects)
+ end
+ end
+
+ function edit_subjectname_HRV_callback(src,eventdata)
+ % get variables
+ subjectsNum=DATA.GUI.SubjectsNum;
+ subjects=DATA.Subjects;
+ subjectname=get(edit_subjectname_HRV,'String');
+
+ % find subject to plot
+ comp=strcmp(subjects,subjectname);
+ sub=find(comp==1);
+
+ % update
+ DATA.GUI.Subject2plot_HRV=sub;
+ plot_HRV(axes_HRV,[]);
+ end
+
+ function dwncond_HRV(src,eventdata)
+ % get data
+ cond=DATA.GUI.Cond2plot_HRV;
+
+ % change condition to plot
+ if isempty(cond)
+ cond=1;
+ end
+ if cond>1
+ cond=cond-1;
+ end
+ DATA.GUI.Cond2plot_HRV=cond;
+
+ % update
+ plot_HRV(axes_HRV,[]);
+ update_condname_HRV(edit_condname_HRV,[]);
+ update_info1_HRV(txt_info1_HRV,[])
+ end
+
+ function upcond_HRV(src,eventdata)
+ % get data
+ cond=DATA.GUI.Cond2plot_HRV;
+
+ % change condition to plot
+ if isempty(cond)
+ cond=1;
+ end
+ if cond1 % plot individual conditions
+ set (src,'String',conditions{cond})
+ else
+ set (src,'String',conditions)
+ end
+ end
+
+ function edit_condname_HRV_callback(src,eventdata)
+ % get variables
+ condNum=DATA.GUI.HRVconditionsNum;
+ conditions=DATA.GUI.HRVconditions;
+ condname=get(edit_condname_HRV,'String');
+
+ % find conditions to plot
+ comp=strcmp(conditions,condname);
+ cond=find(comp==1);
+ if cond==0
+ cond=[];
+ end
+
+ % update
+ DATA.GUI.Cond2plot_HRV=cond;
+ plot_HRV(axes_HRV,[]);
+ end
+
+ function update_info1_HRV(src,eventdata)
+ format short
+ % get variables
+ sub=DATA.GUI.Subject2plot_HRV;
+ if isempty(sub)
+ sub=1;
+ end
+ cond2plot=DATA.GUI.Cond2plot_HRV;
+ conditions=DATA.GUI.HRVconditions;
+ graph=DATA.GUI.HRV2plot;
+ conds=DATA.GUI.HRVconditionsNum;
+ if isempty(conds)
+ conds='';
+ else
+ conds=mat2str(DATA.GUI.HRVconditionsNum);
+ end
+ if isempty(graph)
+ graph='Epochs';
+ end
+
+ switch graph
+ case 'Epochs' % epochs info
+ set(src,'String',{...
+ ['Conditions: ' conds];...
+ ['Epoch Start: ' DATA.GUI.HRV_EpochStart];...
+ ['Epoch End: ' DATA.GUI.HRV_EpochEnd]});
+
+ case 'Spectral' % spectral info
+ cond=conditions{cond2plot};
+ data=DATA.HRV.Spectral(sub).(cond);
+ HF=sprintf('%0.3f',data.HF);
+ LF=sprintf('%0.3f',data.LF);
+ points=DATA.GUI.Spectral_Points;
+ cut=find(points=='(');
+ if ~isempty(cut)
+ points=points(1:cut-1);
+ end
+ set(src,'String',{...
+ ['Conditions: ' mat2str(DATA.GUI.HRVconditionsNum)];...
+ ['Epoch Start: ' DATA.GUI.HRV_EpochStart];...
+ ['Epoch End: ' DATA.GUI.HRV_EpochEnd];...
+ ['Points: ' points];...
+ ['HF: ' HF];...
+ ['LF: ' LF]});
+ update_info2_HRV(txt_info2_HRV,[]);
+
+ case 'DFA' % DFA info
+ cond=conditions{cond2plot};
+ data=DATA.HRV.DFA(sub).(cond);
+ a=sprintf('%0.3f',data.a);
+ set(src,'String',{...
+ ['Conditions: ' mat2str(DATA.GUI.HRVconditionsNum)];...
+ ['Epoch Start: ' DATA.GUI.HRV_EpochStart];...
+ ['Epoch End: ' DATA.GUI.HRV_EpochEnd];...
+ ['alpha: ' a]});
+ update_info2_HRV(txt_info2_HRV,[]);
+ end
+ end
+
+ function update_info2_HRV(src,eventdata)
+ % get variables
+ sub=DATA.GUI.Subject2plot_HRV;
+ if isempty(sub)
+ sub=1;
+ end
+ cond2plot=DATA.GUI.Cond2plot_HRV;
+ conditions=DATA.GUI.HRVconditions;
+ graph=DATA.GUI.HRV2plot;
+
+ switch graph
+ case 'Spectral'
+ cond=conditions{cond2plot};
+ data=DATA.HRV.Spectral(sub).(cond);
+ avIBI=sprintf('%0.2f',data.avIBI);
+ maxIBI=sprintf('%0.2f',data.maxIBI);
+ minIBI=sprintf('%0.2f',data.minIBI);
+ RMSSD=sprintf('%0.2f',data.RMSSD);
+ SDNN=sprintf('%0.2f',data.SDNN);
+ set(src,'String',{...
+ ['mean IBI: ' avIBI];...
+ ['max IBI: ' maxIBI];...
+ ['min IBI: ' minIBI];...
+ ['RMSSD: ' RMSSD];...
+ ['SDNN: ' SDNN]});
+
+ case 'DFA'
+ cond=conditions{cond2plot};
+ data=DATA.HRV.DFA(sub).(cond);
+ avIBI=sprintf('%0.2f',data.avIBI);
+ maxIBI=sprintf('%0.2f',data.maxIBI);
+ minIBI=sprintf('%0.2f',data.minIBI);
+ RMSSD=sprintf('%0.2f',data.RMSSD);
+ SDNN=sprintf('%0.2f',data.SDNN);
+ set(src,'String',{...
+ ['mean IBI: ' avIBI];...
+ ['max IBI: ' maxIBI];...
+ ['min IBI: ' minIBI];...
+ ['RMSSD: ' RMSSD];...
+ ['SDNN: ' SDNN]});
+ end
+ end
+
+%% Button Down Callbacks
+%% ---- IBIs
+ function buttondown_IBIs(src,eventdata)
+ % get variables
+ subjects=DATA.Subjects;
+ sub=DATA.GUI.Subject2plot_IBIs;
+
+ % draw figure and axes
+ popfigure=figure(...
+ 'Name','KARDIA - Interbeat Intervals',...
+ 'NumberTitle','off');
+ axes_popfigure = axes(...
+ 'Parent',popfigure,...
+ 'CameraPosition',[0.5 0.5 9.16025403784439],...
+ 'CameraPositionMode',get(0,'defaultaxesCameraPositionMode'),...
+ 'Color',get(0,'defaultaxesColor'),...
+ 'ColorOrder',get(0,'defaultaxesColorOrder'),...
+ 'FontSize',7,...
+ 'LooseInset',[0.13569492144684 0.125485436893204 0.0991616733649981 0.0855582524271844],...
+ 'XColor',get(0,'defaultaxesXColor'),...
+ 'YColor',get(0,'defaultaxesYColor'),...
+ 'YLim',get(0,'defaultaxesYLim'),...
+ 'XLimMode','auto',...
+ 'YLimMode','auto',...
+ 'ZColor',get(0,'defaultaxesZColor'),...
+ 'UserData',[]);
+
+ % plot
+ plot_IBIs(axes_popfigure,[])
+ title('Interbeat Intervals','Fontsize',10)
+ xlabel('Beats','Fontsize',10)
+ ylabel('Time (sec)','Fontsize',10)
+ if isempty(sub)
+ legend(subjects)
+ elseif sub==0
+ legend(subjects)
+ else
+ if DATA.GUI.SubjectsNum>1
+ legend(subjects(sub))
+ else
+ legend(subjects)
+ end
+ end
+ end
+
+%% ---- PCR
+ function buttondown_PCR(src,eventdata)
+ % get variables
+ subjects=DATA.Subjects;
+ sub=DATA.GUI.Subject2plot_PCR;
+ check=get(check_removebsl_PCR,'Value');
+ unit=DATA.GUI.PCR_Unit;
+
+ % draw figure and axes
+ if isempty(sub) || sub==0 % subject to plot
+ subject='all';
+ else
+ subject=subjects{sub};
+ end
+ popfigure=figure(...
+ 'Name',['KARDIA - Phasic Cardiac Responses - Subject: ',...
+ subject],...
+ 'NumberTitle','off');
+ axes_popfigure = axes(...
+ 'Parent',popfigure,...
+ 'CameraPosition',[0.5 0.5 9.16025403784439],...
+ 'CameraPositionMode',get(0,'defaultaxesCameraPositionMode'),...
+ 'Color',get(0,'defaultaxesColor'),...
+ 'ColorOrder',get(0,'defaultaxesColorOrder'),...
+ 'FontSize',7,...
+ 'LooseInset',[0.13569492144684 0.125485436893204 0.0991616733649981 0.0855582524271844],...
+ 'XColor',get(0,'defaultaxesXColor'),...
+ 'YColor',get(0,'defaultaxesYColor'),...
+ 'YLim',get(0,'defaultaxesYLim'),...
+ 'YLimMode','auto',...
+ 'XLimMode','auto',...
+ 'ZColor',get(0,'defaultaxesZColor'),...
+ 'UserData',[]);
+
+ % plot
+ plot_PCR(axes_popfigure,[])
+ title('Phasic Cardiac Responses','Fontsize',10)
+ xlabel('Time (sec)','Fontsize',10)
+ ylabel(['Cardiac Response (' unit ')'],'Fontsize',10)
+ legend(DATA.GUI.PCRconditions)
+ end
+
+%% ---- HRV
+ function buttondown_HRV(src,eventdata)
+ % get variables
+ subjects=DATA.Subjects;
+ sub=DATA.GUI.Subject2plot_HRV;
+ graph=DATA.GUI.HRV2plot;
+ cond=DATA.GUI.Cond2plot_HRV;
+ conditions=DATA.GUI.HRVconditions;
+
+ % draw figure and axes
+ condition=conditions{cond};
+ popfigure=figure(...
+ 'Name',['KARDIA - HRV - Condition: ',...
+ condition],...
+ 'NumberTitle','off');
+ axes_popfigure = axes(...
+ 'Parent',popfigure,...
+ 'CameraPosition',[0.5 0.5 9.16025403784439],...
+ 'CameraPositionMode',get(0,'defaultaxesCameraPositionMode'),...
+ 'Color',get(0,'defaultaxesColor'),...
+ 'ColorOrder',get(0,'defaultaxesColorOrder'),...
+ 'FontSize',7,...
+ 'LooseInset',[0.13569492144684 0.125485436893204 0.0991616733649981 0.0855582524271844],...
+ 'XColor',get(0,'defaultaxesXColor'),...
+ 'YColor',get(0,'defaultaxesYColor'),...
+ 'YLim',get(0,'defaultaxesYLim'),...
+ 'YLimMode','auto',...
+ 'XLimMode','auto',...
+ 'ZColor',get(0,'defaultaxesZColor'),...
+ 'UserData',[]);
+
+ if isempty(graph)
+ return
+ end
+
+ % plot
+ plot_HRV(axes_popfigure,[])
+
+ switch graph
+ case 'Epochs'
+ title('IBI Epochs','Fontsize',10)
+ ylabel('Time (sec)','Fontsize',10)
+ xlabel('Beats','Fontsize',10)
+ case 'Spectral'
+ title('Spectral Graph','Fontsize',10)
+ xlabel('Frequency (Hz)','Fontsize',10)
+ ylabel('PSD (ms^2/Hz)','Fontsize',10)
+ end
+
+ if isempty(sub)
+ legend(subjects)
+ elseif sub==0
+ legend(subjects)
+ else
+ if DATA.GUI.SubjectsNum>1
+ legend(subjects(sub))
+ else
+ legend(subjects)
+ end
+ end
+ end
+
+%% Toolbar Callbacks
+%% ---- Save Mat Variable
+ function saveDATA_callback(src,evtdata)
+ datafile = inputdlg('Filename','Save Data');
+ if ~isempty(datafile)
+ save ([datafile{1} '.mat'],'DATA')
+ end
+ end
+
+%% ---- Export Data to Excel
+ function excel_callback(src,evtdata)
+ % set warning off
+ warning off MATLAB:xlwrite:AddSheet
+
+ % Add Java POI Libs to matlab javapath
+ xlwrite_filepath=which('kardia.m');
+ xlwrite_filepath=xlwrite_filepath(1:end-length('kardia.m'));
+ xlwrite_filepath=[xlwrite_filepath 'Plugins/xlwrite/'];
+
+ javaaddpath([xlwrite_filepath 'poi_library/poi-3.8-20120326.jar']);
+ javaaddpath([xlwrite_filepath 'poi_library/poi-ooxml-3.8-20120326.jar']);
+ javaaddpath([xlwrite_filepath 'poi_library/poi-ooxml-schemas-3.8-20120326.jar']);
+ javaaddpath([xlwrite_filepath 'poi_library/xmlbeans-2.3.0.jar']);
+ javaaddpath([xlwrite_filepath 'poi_library/dom4j-1.6.1.jar']);
+ javaaddpath([xlwrite_filepath 'poi_library/stax-api-1.0.1.jar']);
+
+ % create data structures for excel
+ subNum=DATA.GUI.SubjectsNum;
+
+ %% General sheet
+ % subject names
+ data=DATA.Subjects';
+ if ischar(data)
+ data=data';
+ end
+ SubjectsGeneral=[{'Subjects'}; data];
+ % conditions
+ data=DATA.Conditions';
+ allconditions=[{'Conditions'}; data];
+ % eventfiles
+ eventfiles=DATA.GUI.Eventfiles;
+ eventfiles=[{'Event Files'}; eventfiles];
+
+ %% PCR sheet
+ % conditions
+ PCRconds=DATA.GUI.PCRconditions;
+ % parameters
+ epochstart=DATA.GUI.PCR_EpochStart;
+ epochend=DATA.GUI.PCR_EpochEnd;
+ algorithm=DATA.GUI.PCR_Algorithm;
+ PCRunits=DATA.GUI.PCR_Unit;
+ window=DATA.GUI.PCR_TimeWindow;
+ PCRparameterNames={...
+ 'Parameters';...
+ 'Epoch Start';...
+ 'Epoch End';...
+ 'Algorithm';...
+ 'Unit';...
+ 'Time Window'};
+ PCRparameters={...
+ '';...
+ epochstart;...
+ epochend;...
+ algorithm;...
+ PCRunits;...
+ window};
+ % grand average
+ data=DATA.PCR_GrandAverage;
+ conds=PCRconds';
+ condsnum=DATA.GUI.PCRconditionsNum;
+ varnamesPCR={...
+ 'Subjects';...
+ 'Conditions';...
+ 'Baseline';...
+ 'Values'};
+ bsl_values=[];
+ hr_values=[];
+ for i=1:condsnum
+ bsl_values=[bsl_values data.(conds{i}).BSL];
+ hr_values=[hr_values data.(conds{i}).HR'];
+ end
+
+ % create empty matrixes if PCR is absent
+ datamatrixPCR=DATA.GUI.PCRdatamatrix;
+ count=1;
+ for i=1:DATA.GUI.PCRconditionsNum % conditions header
+ headerPCR(count:count+subNum-1)=PCRconds(i);
+ count=count+subNum;
+ end
+ if isempty(DATA.GUI.PCRconditionsNum)
+ headerPCR=[];
+ end
+ SubjectsPCR=DATA.Subjects;
+ if subNum>1
+ SubjectsPCR=repmat(SubjectsPCR,1,DATA.GUI.PCRconditionsNum);
+ elseif subNum==1
+ SubjectsPCR={SubjectsPCR};
+ elseif isempty(subNum)
+ SubjectsPCR={''};
+ end
+
+ %% HRV
+ % parameters
+ HRVparameterNames={...
+ 'Parameters';...
+ 'Epoch Start';...
+ 'Epoch End';...
+ '';...
+ 'Spectral Analysis';...
+ 'Sample Rate';...
+ 'Points';...
+ 'Detrend Method';...
+ 'Filter';...
+ 'Algorithm';...
+ 'AR order';...
+ '';...
+ 'DFA'
+ 'Minbox';...
+ 'Maxbox';...
+ 'Sliding Windows'};
+ HRVparameters={...
+ '';...
+ DATA.GUI.HRV_EpochStart;...
+ DATA.GUI.HRV_EpochEnd;...
+ '';...
+ '';...
+ DATA.GUI.Spectral_SampleRate;...
+ DATA.GUI.Spectral_Points;...
+ DATA.GUI.Spectral_DetrendMethod;...
+ DATA.GUI.Spectral_Filter;...
+ DATA.GUI.Spectral_Algorithm;...
+ DATA.GUI.Spectral_ARorder;...
+ '';...
+ '';...
+ DATA.GUI.DFA_minbox;...
+ DATA.GUI.DFA_maxbox;...
+ DATA.GUI.DFA_sliding};
+
+ % grand average
+ HRVconds=DATA.GUI.HRVconditions;
+ count=1;
+ for i=1:DATA.GUI.HRVconditionsNum % conditions header
+ headerHRV(count:count+subNum-1)=HRVconds(i);
+ count=count+subNum;
+ end
+ if isempty(DATA.GUI.HRVconditionsNum)
+ headerHRV=[];
+ end
+ SubjectsHRV=DATA.Subjects;
+ if subNum>1
+ SubjectsHRV=repmat(SubjectsHRV,1,DATA.GUI.HRVconditionsNum);
+ elseif subNum==1
+ SubjectsHRV={SubjectsHRV};
+ elseif isempty(subNum)
+ SubjectsHRV={''};
+ end
+
+ meanHF=[];
+ meanLF=[];
+ meanVLF=[];
+ meanRMSSD=[];
+ meanSDNN=[];
+ meanavIBI=[];
+ meanalpha=[];
+ datamatrixHRV=[];
+ for j=1:DATA.GUI.HRVconditionsNum
+ HF=[];
+ LF=[];
+ VLF=[];
+ RMSSD=[];
+ SDNN=[];
+ avIBI=[];
+ alpha=[];
+ for i=1:subNum
+ if ~isempty(DATA.HRV.Spectral)
+ HF=[HF DATA.HRV.Spectral(1,i).(HRVconds{j}).HF];
+ LF=[LF DATA.HRV.Spectral(1,i).(HRVconds{j}).LF];
+ VLF=[VLF DATA.HRV.Spectral(1,i).(HRVconds{j}).VLF];
+ RMSSD=[RMSSD DATA.HRV.Spectral(1,i).(HRVconds{j}).RMSSD];
+ SDNN=[SDNN DATA.HRV.Spectral(1,i).(HRVconds{j}).SDNN];
+ avIBI=[avIBI DATA.HRV.Spectral(1,i).(HRVconds{j}).avIBI];
+ end
+ if ~isempty(DATA.HRV.DFA)
+ alpha=[alpha DATA.HRV.DFA(1,i).(HRVconds{j}).a];
+ end
+ end
+
+ % all subjects
+ matrix=[avIBI;SDNN;RMSSD;HF;LF;VLF;alpha];
+ datamatrixHRV=[datamatrixHRV matrix];
+
+ % grand average
+ meanHF=[meanHF mean(HF)];
+ meanLF=[meanLF mean(LF)];
+ meanVLF=[meanVLF mean(VLF)];
+ meanRMSSD=[meanRMSSD mean(RMSSD)];
+ meanSDNN=[meanSDNN mean(SDNN)];
+ meanavIBI=[meanavIBI mean(avIBI)];
+ meanalpha=[meanalpha mean(alpha)];
+ end
+ DATA.GUI.HRVdatamatrix=datamatrixHRV;
+
+ HRV_VariableNames={...
+ 'Subjects';...
+ 'Conditions';...
+ 'Average IBI';...
+ 'SDNN';...
+ 'RMSSD';...
+ 'HF';...
+ 'LF';...
+ 'VLF';...
+ 'alpha exponent'};
+
+ HRV_Variables=[...
+ meanavIBI;...
+ meanSDNN;...
+ meanRMSSD;...
+ meanHF;...
+ meanLF;...
+ meanVLF;...
+ meanalpha];
+
+ % Write excel file
+ datafile = inputdlg('Filename','Excel');
+ if ~isempty(datafile)
+ % check if file exists
+ if exist([datafile{1} '.xls'],'file')
+ quest = questdlg(['Excel file already exists. '...
+ 'Do you want to overwrite?'],'Excel');
+ switch quest
+ case 'No'
+ return
+ case 'Cancel'
+ return
+ end
+ end
+
+ % General Sheet
+ xlwrite([datafile{1} '.xls'],SubjectsGeneral,'General','A1');
+ xlwrite([datafile{1} '.xls'],eventfiles,'General','B1');
+ xlwrite([datafile{1} '.xls'],allconditions,'General','C1');
+
+ % PCR Sheet
+ if isempty(headerPCR)
+ headerPCR={''};
+ end
+ if isempty(datamatrixPCR)
+ datamatrixPCR={''};
+ end
+ xlwrite([datafile{1} '.xls'],PCRparameterNames,'PCR','A1');
+ xlwrite([datafile{1} '.xls'],PCRparameters,'PCR','B1');
+ xlwrite([datafile{1} '.xls'],headerPCR,'PCR','E2');
+ xlwrite([datafile{1} '.xls'],SubjectsPCR,'PCR','E1');
+ xlwrite([datafile{1} '.xls'],varnamesPCR,'PCR','D1');
+ xlwrite([datafile{1} '.xls'],datamatrixPCR,'PCR','E3');
+
+ % PCR Grand Average Sheet
+ if isempty(PCRconds)
+ PCRconds={''};
+ end
+ if isempty(bsl_values)
+ bsl_values={''};
+ end
+ if isempty(hr_values)
+ hr_values={''};
+ end
+ xlwrite([datafile{1} '.xls'],PCRparameterNames,'PCR Grand Average','A1');
+ xlwrite([datafile{1} '.xls'],PCRparameters,'PCR Grand Average','B1');
+ xlwrite([datafile{1} '.xls'],PCRconds,'PCR Grand Average','E1');
+ xlwrite([datafile{1} '.xls'],bsl_values,'PCR Grand Average','E2');
+ xlwrite([datafile{1} '.xls'],varnamesPCR(2:4,:),'PCR Grand Average','D1');
+ xlwrite([datafile{1} '.xls'],hr_values,'PCR Grand Average','E3');
+
+ % HRV Sheet
+ if isempty(headerHRV)
+ headerHRV={''};
+ end
+ if isempty(datamatrixHRV)
+ datamatrixHRV={''};
+ end
+ xlwrite([datafile{1} '.xls'],HRVparameterNames,'HRV','A1');
+ xlwrite([datafile{1} '.xls'],HRVparameters,'HRV','B1');
+ xlwrite([datafile{1} '.xls'],HRV_VariableNames,'HRV','D1');
+ xlwrite([datafile{1} '.xls'],SubjectsHRV,'HRV','E1');
+ xlwrite([datafile{1} '.xls'],headerHRV,'HRV','E2');
+ xlwrite([datafile{1} '.xls'],datamatrixHRV,'HRV','E3');
+
+ % HRV Average Sheet
+ if isempty(HRVconds)
+ HRVconds={''};
+ end
+ if isempty(HRV_Variables)
+ HRV_Variables={''};
+ end
+ xlwrite([datafile{1} '.xls'],HRVparameterNames,'HRV Average','A1');
+ xlwrite([datafile{1} '.xls'],HRVparameters,'HRV Average','B1');
+ xlwrite([datafile{1} '.xls'],HRV_VariableNames(2:end,:),'HRV Average','D1');
+ xlwrite([datafile{1} '.xls'],HRVconds,'HRV Average','E1');
+ xlwrite([datafile{1} '.xls'],HRV_Variables,'HRV Average','E2');
+ end
+ end
+
+%% ---- User's Guide
+ function tutorial_callback(src,evtdata)
+ filepath=which('kardia.m');
+ filepath=filepath(1:end-length('kardia.m'));
+ filepath=[filepath 'Documentation/'];
+ uiopen([filepath 'User''s Guide.pdf'],1);
+ end
+
+%% ---- About KARDIA
+ function about_callback(src,evtdata)
+ about_figure = figure(...
+ 'Units','characters',...
+ 'PaperUnits',get(0,'defaultfigurePaperUnits'),...
+ 'Color',[0.925490196078431 0.913725490196078 0.847058823529412],...
+ 'Colormap',[0 0 0.5625;0 0 0.625;0 0 0.6875;0 0 0.75;0 0 0.8125;0 0 0.875;0 0 0.9375;0 0 1;0 0.0625 1;0 0.125 1;0 0.1875 1;0 0.25 1;0 0.3125 1;0 0.375 1;0 0.4375 1;0 0.5 1;0 0.5625 1;0 0.625 1;0 0.6875 1;0 0.75 1;0 0.8125 1;0 0.875 1;0 0.9375 1;0 1 1;0.0625 1 1;0.125 1 0.9375;0.1875 1 0.875;0.25 1 0.8125;0.3125 1 0.75;0.375 1 0.6875;0.4375 1 0.625;0.5 1 0.5625;0.5625 1 0.5;0.625 1 0.4375;0.6875 1 0.375;0.75 1 0.3125;0.8125 1 0.25;0.875 1 0.1875;0.9375 1 0.125;1 1 0.0625;1 1 0;1 0.9375 0;1 0.875 0;1 0.8125 0;1 0.75 0;1 0.6875 0;1 0.625 0;1 0.5625 0;1 0.5 0;1 0.4375 0;1 0.375 0;1 0.3125 0;1 0.25 0;1 0.1875 0;1 0.125 0;1 0.0625 0;1 0 0;0.9375 0 0;0.875 0 0;0.8125 0 0;0.75 0 0;0.6875 0 0;0.625 0 0;0.5625 0 0],...
+ 'MenuBar','none',...
+ 'Name','About',...
+ 'NumberTitle','off',...
+ 'PaperPosition',get(0,'defaultfigurePaperPosition'),...
+ 'PaperSize',[20.98404194812 29.67743169791],...
+ 'PaperType',get(0,'defaultfigurePaperType'),...
+ 'Position',[90 20 109 30],...
+ 'Resize','off',...
+ 'HandleVisibility','callback',...
+ 'Tag','figure1',...
+ 'UserData',[]);
+
+ h = uicontrol(...
+ 'Parent',about_figure,...
+ 'Units','characters',...
+ 'CData',[],...
+ 'Position',[5.2 1.46153846153846 97.4 26.0769230769231],...
+ 'String',{...
+ 'KARDIA: Matlab graphic user interface environment for the analysis';...
+ 'of Cardiac Interbeat Interval data. Developed for the Human Psychophysiology ';...
+ 'research group in the University of Granada in Spain. First released on ';...
+ '11/2007 under GNU General Public License.';...
+ blanks(0);...
+ 'Copyright (C) 2007 2008 Pandelis Perakakis';...
+ blanks(0);...
+ ' This program 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.';...
+ blanks(0);...
+ ' This program 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.';...
+ blanks(0);...
+ ' You should have received a copy of the GNU General Public License';...
+ ' along with this program. If not, see .';...
+ blanks(0);...
+ 'To report bugs or for any other comments please contact: peraka@ugr.es ' },...
+ 'Style','text',...
+ 'Tag','text1',...
+ 'UserData',[]);
+ end
+
+%% ---------- AUXILARY FUNCTIONS -----------
+%% ---- Clear Function
+ function clearFcn
+ DATA.Subjects=[];
+ DATA.R_events=[];
+ DATA.IBIs=[];
+ DATA.Events=[];
+ DATA.Conditions=[];
+ DATA.Epochs=[];
+ DATA.PCR=[];
+ DATA.PCR_GrandAverage=[];
+ DATA.HRV=[];
+ DATA.HRV.Spectral=[];
+ DATA.HRV.DFA=[];
+ DATA.GUI.SubjectsNum=[];
+ DATA.GUI.Subject2plot_IBIs=[];
+ DATA.GUI.Subject2plot_PCR=[];
+ DATA.GUI.Subject2plot_HRV=[];
+ DATA.GUI.Cond2plot_HRV=[];
+ DATA.GUI.Eventfiles=[];
+ DATA.GUI.EventsNum=[];
+ DATA.GUI.ConditionsNum=[];
+ DATA.GUI.PCRconditions=[];
+ DATA.GUI.PCRconditionsNum=[];
+ DATA.GUI.PCR_EpochStart=[];
+ DATA.GUI.PCR_EpochEnd=[];
+ DATA.GUI.PCR_Algorithm=[];
+ DATA.GUI.PCR_TimeWindow=[];
+ DATA.GUI.PCR_Unit=[];
+ DATA.GUI.PCRdatamatrix=[];
+ DATA.GUI.UseCommonEventfile=[];
+ DATA.GUI.HRVconditions=[];
+ DATA.GUI.HRVconditionsNum=[];
+ DATA.GUI.HRV_EpochStart=[];
+ DATA.GUI.HRV_EpochEnd=[];
+ DATA.GUI.HRVdatamatrix=[];
+ DATA.GUI.PCRepochs=[];
+ DATA.GUI.Spectral_SampleRate=[];
+ DATA.GUI.Spectral_Points=[];
+ DATA.GUI.Spectral_ARorder=[];
+ DATA.GUI.Spectral_Filter=[];
+ DATA.GUI.Spectral_Algorithm=[];
+ DATA.GUI.Spectral_DetrendMethod=[];
+ DATA.GUI.HRV2plot=[];
+ DATA.GUI.Spectral_Scale=[];
+ DATA.GUI.DFA_minbox=[];
+ DATA.GUI.DFA_maxbox=[];
+ DATA.GUI.DFA_sliding=[];
+ end
+
+%% ---- CDR
+ function [baselineHR,medians,Vsec]=CDR(sig,TS,baseline)
+ % transpose data vector
+ if size(sig,1)>size(sig,2)
+ sig=sig';
+ end
+
+ % create heart period vector
+ [hp,t]=ecg_hp(sig,'instantaneous');
+
+ % define T0 to calculate baseline heart rate
+ T0=TS-baseline;
+ baselineHR=ecg_stat(t,T0,TS,'mean','bpm'); % baseline Heart Rate
+
+ % calculate mean heart rate sec by sec
+ Vsec=[];
+ count=0;
+ for i=1:80
+ V=ecg_stat(t,TS+count,TS+i,'mean','bpm');
+ count=count+1;
+ Vsec=[Vsec V];
+ end
+
+ % calculate medians
+ medians=[median(Vsec(1:3)) median(Vsec(4:6)) median(Vsec(7:11)) median(Vsec(12:16))...
+ median(Vsec(17:23)) median(Vsec(24:30)) median(Vsec(31:37)) median(Vsec(38:50))...
+ median(Vsec(51:63)) median(Vsec(64:76))];
+ end
+
+%% ---- PCR
+ function [HRmean,HRbsl]=PCR(t,TS,T0,T1,step,unit)
+
+ % get heart period
+ [hp,t]=ecg_hp(t,'instantaneous');
+
+ % calculate baseline HR
+ HRbsl=ecg_stat(t,T0,TS,'mean',unit); % call ecg_stat
+
+ % calculate mean HR changes in variable window sizes defined by step
+ nboxes=floor(T1/step); % number of boxes that fit in analysis window
+ HRmean=[];
+ count=0;
+ for i=1:nboxes
+ mhr=ecg_stat(t,TS+count*step,TS+step*i,'mean',unit);
+ count=count+1;
+ HRmean=[HRmean mhr];
+ end
+ end
+
+%% ---- DFA
+ function [alpha,n,Fn]=DFA(y,varargin)
+ % set default values for input arguments
+ sliding=0;
+ graph=0;
+ minbox=4;
+ maxbox=floor(length(y)/4);
+
+ % check input arguments
+ nbIn = nargin;
+ if nbIn > 1
+ if ~ischar(varargin{1})
+ minbox = varargin{1};
+ if ~ischar(varargin{2})
+ maxbox = varargin{2};
+ else
+ error('Input argument missing.');
+ end
+ end
+ for i=1:nbIn-1
+ if isequal (varargin{i},'plot'), graph='plot';end
+ if isequal (varargin{i},'s'), sliding='s';end
+ end
+ end
+
+ if nbIn > 5
+ error('Too many input arguments.');
+ end
+
+ % initialize output variables
+ alpha=[];
+ n=NaN(1,maxbox-minbox+1);
+ Fn=NaN(1,maxbox-minbox+1);
+
+ % transpose data vector if necessary
+ s=size(y);
+ if s(1)>1
+ y=y';
+ end
+
+ % substract mean
+ y=y-mean(y);
+
+ % integrate time series
+ y=cumsum(y);
+
+ N=length(y); % length of data vector
+
+ % error message when box size exceeds permited limits
+ if minbox<4 || maxbox>N/4
+ disp([mfilename ': either minbox too small or maxbox too large!']);
+ return
+ end
+
+ % begin loop to change box size
+ count=1;
+ for n=minbox:maxbox;
+ i=1;
+ r=N;
+ m=[];
+ l=[];
+
+ % begin loop to create a new detrended time series using boxes of size n starting
+ % from the beginning of the original time series
+ while i+n-1<=N % create box size n
+ x=y(i:i+n-1);
+ x=detrend(x); % linear detrending
+ m=[m x];
+ if strcmp(sliding,'s')
+ i=i+1; % sliding window
+ else
+ i=i+n; % non-overlapping windows
+ end
+ end
+
+ % begin loop to create a new detrended time series with boxes of size n starting
+ % from the end of the original time series
+ while r-n+1>=1
+ z=y(r:-1:r-n+1);
+ z=detrend(z);
+ l=[l z];
+ if strcmp(sliding,'s')
+ r=r-1;
+ else
+ r=r-n;
+ end
+ end
+
+ % calculate the root-mean-square fluctuation of the new time series
+ k=[m l]; % concatenate the two detrended time series
+ k=k.^2;
+ k=mean(k);
+ k=sqrt(k);
+ Fn(count)=k;
+ count=count+1;
+ end
+
+ n=minbox:maxbox;
+
+ % plot the DFA
+ if strcmp (graph,'plot');
+ figure;
+ plot(log10(n),log10(Fn))
+ xlabel('log(n)')
+ ylabel('log(Fn)')
+ title('Detrended Fluctuation Analysis')
+ end
+
+ % calculate scaling factor alpha
+ coeffs = polyfit(log10(n),log10(Fn),1);
+ alpha = coeffs(1);
+
+ end
+
+%% ---- RMSSD
+ function y=RMSSD(sig)
+
+ dsig=diff(sig);
+ y=dsig.^2;
+ y=sqrt(mean(y));
+ end
+
+%% ---- spPCRower
+ function power=spPCRower(F,PSD,freq)
+ % define frequency bands
+ vlf=0.04; % very low frequency band
+ lf=0.15; % low frequency band
+ hf=0.4; % high frequency band
+
+ % calculate number of points in the spectrum
+ N=length(PSD);
+ %calculate maximum frequency
+ maxF=F(2)*N;
+
+ if hf>F(end),
+ hf=F(end);
+ if lf>hf,
+ lf=F(end-1);
+ if vlf>lf,
+ vlf=F(end-2);
+ end
+ end
+ end
+
+ %calculate limiting points in each band
+ index_vlf=round(vlf*N/maxF)+1;
+ index_lf=round(lf*N/maxF)+1;
+ index_hf=round(hf*N/maxF)+1;
+ if index_hf>N,index_hf=N;end
+
+ switch freq
+ case {'total'}
+ % calculate total energy (from 0 to hf) in ms^2
+ total=F(2)*sum(PSD(1:index_hf-1));
+ power=total;
+ case {'vlf'}
+ %calculate energy of very low frequencies (from 0 to vlf2)
+ vlf=F(2)*sum(PSD(1:index_vlf-1));
+ power=vlf;
+ case {'lf'}
+ %calculate energy of low frequencies (from vlf2 to lf2)
+ lf=F(2)*sum(PSD(index_vlf:index_lf-1));
+ power=lf;
+ case {'hf'}
+ %calculate energy of high frequencies (from lf2 to hf2)
+ hf=F(2)*sum(PSD(index_lf:index_hf-1));
+ power=hf;
+ case {'nlf'}
+ %calculate normalized low frequency
+ lf=F(2)*sum(PSD(index_vlf:index_lf-1));
+ hf=F(2)*sum(PSD(index_lf:index_hf-1));
+ nlf=lf/(lf+hf);
+ power=nlf;
+ case {'nhf'}
+ %calculate normalized low frequency
+ lf=F(2)*sum(PSD(index_vlf:index_lf-1));
+ hf=F(2)*sum(PSD(index_lf:index_hf-1));
+ nhf=hf/(lf+hf);
+ power=nhf;
+ otherwise
+ disp('Uknown frequency range selection')
+ power=nan;
+ end
+ end
+
+%% ---- ecg_hp
+ function [hp, thp]=ecg_hp(t, method)
+ % ECG_HP Calculate the 'instantaneous' or 'delayed' heart period.
+ % [hp, thp] = ECG_HP(t, method)
+ %
+ % Input arguments:
+ % t - heart beats' time (at least two beats must be recorded)
+ % method - 'instantaneous': return the instantaneous HP
+ % 'delayed': return the delayed HP
+ % (see description below)
+ %
+ % Output arguments:
+ % hp - instantaneous heart period
+ % thp - instantaneous heart period time
+ %
+ % Description:
+ % The instantaneous heart period is defined as f(t)=t[n+1]-t[n]
+ % for t[n]<=t1
+ hp=diff(t);
+ if strcmp(method, 'instantaneous')
+ thp=t(1:end-1);
+ elseif strcmp(method, 'delayed')
+ thp=t(2:end);
+ else
+ disp ([mfilename ': "' method '" method unknown.' ]);
+ hp=[];
+ thp=[];
+ end
+ else
+ hp=[];
+ thp=[];
+ end
+ end
+
+%% ---- ecg_interp
+ function yy=ecg_interp(t,y,tt,method)
+ % ECG_INTERP interpolate HR series
+ % yy = ECG_INTERP(t,y,tt,method)
+ %
+ % Input arguments:
+ % t - vector of HR instants
+ % y - HR values
+ % tt - vector of instants where HR values should be estimated
+ % method - 'constant', linear' or 'spline'
+ %
+ % Output arguments:
+ % yy - HR values should at 'tt' instants
+ %
+ % Description:
+ % 'constant' seems to be the most frequently used technique to calculate
+ % the averaged instantaneous heart period or rate in psychophysiology
+ % studies. It considers that HR is constant between two adjacent HR intervals.
+ % However, it seems to be the least effective estimate of the
+ % true espectrum. Preference should be done to 'spline' for spectral
+ % estimation.
+ %
+ % References:
+ % Guimaraes & Santos (1998)
+ % -------------------------------------------------------------------------
+ % Written by Mateus Joffily - NeuroII/UFRJ & CNC/CNRS
+
+ if length(y) ~= length(t)
+ disp ([mfilename ': "y" and "t" vectors must have the same length.']);
+ yy=NaN;
+ return
+ end
+
+ switch method
+ case 'constant'
+ yy=[];
+ for i=1:numel(tt)
+ k=find((tt(i)-t)>0);
+ if isempty(k)
+ yy=[yy NaN];
+ else
+ yy=[yy y(k(end))];
+ end
+ end
+
+ case 'linear'
+ yy = interp1(t,y,tt,'linear');
+
+ case 'spline'
+ yy=spline(t,y,tt);
+
+ otherwise
+ yy=NaN;
+ end
+ end
+
+%% ---- ecg_stat
+ function [HRstat, Ncycles] = ecg_stat(t, T0, T1, stat, unit)
+ % ECG_STAT Return statistic within analysis window
+ % [HRstat, Ncycles] = ECG_STAT(t, T0, T1, stat, unit)
+ %
+ % Input arguments:
+ % t - vector of heartbeat instants
+ % T0 - analysis window onset
+ % T1 - analysis window offset
+ % stat - statistics output: 'mean', min' or 'max' values
+ % unit - output (HRstat) unit: 'sec', 'hz' or'bpm'.
+ % 'sec' = the output will be the heart period.
+ % 'hz' = the output will be the heart rate in beats/sec.
+ % 'bpm' = the output will be the heart rate in beats/min.
+ %
+ % Output arguments:
+ % HRstat - statistic output
+ % Ncycles - cycle count
+ %
+ % Description:
+ % Each interval [t0;t1]; [t1;t2]; ... is considered as a cardiac cycle.
+ % For an analysis window delimited by [T0;T1], the number of cycles
+ % within the window is counted. The cycle [ti-1; ti] is counted as:
+ % 1 , if T0 <= ti-1 < ti <= T1;
+ % (ti - T0)/(ti - ti-1) , if ti-1 < T0 < ti <= T1;
+ % (T1 - ti-1)/(ti - ti-1) , if T0 <= ti-1 < T1 < ti;
+ % (T1 - T0)=(ti - ti-1) , if ti-1 < T0 < T1 < ti.
+ % Having defined the cycle count within a window, the mean heart rate
+ % is defined as the ratio of this count to the total window length.
+ %
+ % References:
+ % Dinh et al, 1999; see also Reyes and Vila, 1998
+ %--------------------------------------------------------------------------
+ % Written by Mateus Joffily - NeuroII/UFRJ & CNC/CNRS
+
+ % Initialize output variables
+ HRstat=NaN;
+ Ncycles=NaN;
+
+ % transpose data vector
+ if size(t,1)>size(t,2)
+ t=t';
+ end
+
+ % index of beats inside analysis window [T0;T1]
+ i=find(t>=T0 & t<=T1);
+
+ if isempty(i)
+ % There isn't any beat inside analysis window [T0;T1]
+ % (ti-1 < T0 < T1 < ti)
+ i0=find(tT1);
+ if isempty(i0) || isempty(i1)
+ display('Missing heartbeat instant before T0 or after T1')
+ return
+ end
+ tb=[t(i0(end)) t(i1(1))]; % beat time
+ tc=[T0 T1]; % cycle time
+
+ else
+ % Analysis window [T0;T1] is longer than heart periods
+ tb=t(i); % beat time
+ tc=t(i); % cycle time
+
+ % Adjust beat and cycle times to analysis window
+ if t(i(1))~=T0
+ if i(1)-1<1
+ display('Missing heartbeat instant before T0')
+ return
+ end
+ tb=[t(i(1)-1) tb];
+ tc=[T0 tc];
+ end
+ if t(i(end))~=T1
+ if i(end)+1>length(t)
+ display('Missing heartbeat instant after T1')
+ return
+ end
+ tb=[tb t(i(end)+1)];
+ tc=[tc T1];
+ end
+ end
+
+ % Instantaneous heart period
+ IBI=diff(tb);
+
+ % Cycle count within analysis window
+ Ncycles=sum(diff(tc)./IBI);
+
+ % Analysis window length
+ winlen=T1-T0;
+
+ switch stat
+ case 'mean'
+ HRstat=winlen/Ncycles;
+ case 'min'
+ if strcmp(unit,'bpm') || strcmp(unit, 'hz')
+ HRstat=max(IBI);
+ else
+ HRstat=min(IBI);
+ end
+ case 'max'
+ if strcmp(unit,'bpm') || strcmp(unit, 'hz')
+ HRstat=min(IBI);
+ else
+ HRstat=max(IBI);
+ end
+ end
+
+ switch unit
+ case 'hz'
+ HRstat=1/HRstat;
+ case 'bpm'
+ HRstat=60/HRstat;
+ end
+ end
+
+%% ---- isint
+ function [d,ndx,varout] = isint(varargin)
+
+ C = varargin;
+ nIn = nargin;
+
+ if nIn < 2
+ d = C{:} == round(C{:});
+ else
+ d = zeros(1,nIn);
+ for i = 1:nIn
+ d(i) = isequal(C{i},round(C{i}));
+ end
+ end
+
+ ndx = find(d);
+ temp = [C{:}];
+ varout = temp(ndx);
+ end
+
+end