ita_rotatingWallLT_subjectData.m 10.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302
function varargout = ita_rotatingWallLT_subjectData(varargin)
% ITA_ROTATINGWALLLT_SUBJECTDATA MATLAB code for ita_rotatingWallLT_subjectData.fig
%      ITA_ROTATINGWALLLT_SUBJECTDATA, by itself, creates a new ITA_ROTATINGWALLLT_SUBJECTDATA or raises the existing
%      singleton*.
%

% <ITA-Toolbox>
% This file is part of the application ListeningTests for the ITA-Toolbox. All rights reserved.
% You can find the license for this m-file in the application folder.
% </ITA-Toolbox>

%      H = ITA_ROTATINGWALLLT_SUBJECTDATA returns the handle to a new ITA_ROTATINGWALLLT_SUBJECTDATA or the handle to
%      the existing singleton*.
%
%      ITA_ROTATINGWALLLT_SUBJECTDATA('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in ITA_ROTATINGWALLLT_SUBJECTDATA.M with the given input arguments.
%
%      ITA_ROTATINGWALLLT_SUBJECTDATA('Property','Value',...) creates a new ITA_ROTATINGWALLLT_SUBJECTDATA or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before ita_rotatingWallLT_subjectData_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to ita_rotatingWallLT_subjectData_OpeningFcn via varargin.
%
%      *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 ita_rotatingWallLT_subjectData

% Last Modified by GUIDE v2.5 03-Sep-2014 15:44:07

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @ita_rotatingWallLT_subjectData_OpeningFcn, ...
                   'gui_OutputFcn',  @ita_rotatingWallLT_subjectData_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 ita_rotatingWallLT_subjectData is made visible.
function ita_rotatingWallLT_subjectData_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   command line arguments to ita_rotatingWallLT_subjectData (see VARARGIN)

% Init Data
subjectData.name = [];
str = get(handles.popupSex, 'String');
val = get(handles.popupSex, 'Value');
subjectData.sex = str{val};
subjectData.age = '';
subjectData.fromITA = get(handles.popupFromITA, 'Value');
subjectData.hrtfExperienced = get(handles.checkHRTFExperience, 'Value');
subjectData.date = date;
c = clock;
c = c([4 5]);
subjectData.time = [num2str(c(1)),':', num2str(c(2))];
subjectData.ID = '';
subjectData.group = '';

handles.subjectData = subjectData;

handles.output = NaN;

% Update handles structure
guidata(hObject, handles);

%Figure position and size
set(handles.figure1, 'Units', 'pixels')
scrsz = get(0,'ScreenSize');
maxWidth = scrsz(3);
maxHeight = scrsz(4);
figsize = get(handles.figure1, 'OuterPosition');
width = figsize(3);
height = figsize(4);

position = [(maxWidth-width)/2, (maxHeight-height)/2, width, height]; %[left, bottom, width, height]
set(handles.figure1,'Position', position)

% UIWAIT makes ita_rotatingWallLT_subjectData wait for user response (see UIRESUME)
uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = ita_rotatingWallLT_subjectData_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;
delete(handles.figure1)



function editName_Callback(hObject, eventdata, handles)

handles.subjectData.name = get(hObject, 'String');
guidata(hObject, handles);


% --- Executes on selection change in editID.
function editID_Callback(hObject, eventdata, handles)

str = get(hObject, 'String');

ID = str2double(str);
if isnan(ID)
    ID = -1;
end

if mod(ID, 1) || ID < 1   %integer greater than 0?
   set(hObject, 'String', handles.subjectData.ID)
   msgbox('Enter an integer greater 0')
   return
end

handles.subjectData.ID = ID;
guidata(hObject, handles);

function editGroup_Callback(hObject, eventdata, handles)

str = get(hObject, 'String');

group = str2double(str);
if isnan(group)
    group = -1;
end

if mod(group, 1) || group < 1 || group > 18  %integer between 1 and 18?
   set(hObject, 'String', handles.subjectData.group)
   msgbox('Enter an integer between 1 and 18')
   return
end

handles.subjectData.group = group;
guidata(hObject, handles);


% --- Executes on selection change in editAge.
function editAge_Callback(hObject, eventdata, handles)

str = get(hObject, 'String');

age = str2double(str);
if isnan(age)
    age = -1;
end

if mod(age, 1) || age < 0 || age > 120   %integer between 1 and 120?
   set(hObject, 'String', handles.subjectData.age)
   msgbox('Enter an integer between 0 and 120')
   return
end

handles.subjectData.age = age;
guidata(hObject, handles);


% --- Executes on selection change in popupSex.
function popupSex_Callback(hObject, eventdata, handles)

str = get(hObject, 'String');
val = get(hObject, 'Value');
handles.subjectData.sex = str{val};
guidata(hObject, handles);

% --- Executes on selection change in popupFromITA.
function popupFromITA_Callback(hObject, eventdata, handles)

handles.subjectData.fromITA = get(hObject, 'Value');
%1 = extern, 2 = student, 3 = assistent
guidata(hObject, handles);

% --- Executes on button press in checkHRTFExperience.
function checkHRTFExperience_Callback(hObject, eventdata, handles)

handles.subjectData.hrtfExperienced = get(hObject, 'Value');


% --- Executes on button press in pushSubmit.
function pushSubmit_Callback(hObject, eventdata, handles)

if isempty(handles.subjectData.name) || isempty(handles.subjectData.age) ||...
        isempty(handles.subjectData.ID) || isempty(handles.subjectData.group)
    msgbox('Enter a name, the age and the ID')
    return
end

%last check
button = questdlg('Are all the information correct?','Please check again...','yes','no','no');
if isempty(button)  || strcmp(button, 'no')
    return
end

handles.output = handles.subjectData;
guidata(hObject, handles)
uiresume



% --- Executes when user attempts to close figure1.
function figure1_CloseRequestFcn(hObject, eventdata, handles)

uiresume


%% Create Function

% --- Executes during object creation, after setting all properties.
function editName_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editName (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 during object creation, after setting all properties.
function editAge_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editAge (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 during object creation, after setting all properties.
function editID_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editID (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 during object creation, after setting all properties.
function popupFromITA_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupFromITA (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 during object creation, after setting all properties.
function popupSex_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupSex (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 during object creation, after setting all properties.
function editGroup_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editGroup (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