Skip to content

Commit ad2e49f

Browse files
committed
bugs fix
1 parent 5a3ea9a commit ad2e49f

File tree

3 files changed

+28
-7
lines changed

3 files changed

+28
-7
lines changed

gui.m

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,18 +185,27 @@ function class_path_CreateFcn(hObject, eventdata, handles)
185185
%% CODE FOR ALL THE PATH TEXTS %%
186186
function b_path_data_Callback(hObject, eventdata, handles)
187187
FN_data = uigetdir(matlabroot,'Select data folder');
188+
if FN_data==0
189+
return
190+
end
188191
set(handles.path_data,'String',FN_data);
189192
function b_path_output_Callback(hObject, eventdata, handles)
190193
FN_output = uigetdir(matlabroot,'Select output folder');
194+
if FN_output==0
195+
return
196+
end
191197
set(handles.path_output,'String',FN_output);
192198
function b_path_labels_Callback(hObject, eventdata, handles)
193199
[FN_labels,PN_labels] = uigetfile({'*.csv','CSV-file (*.csv)'},'Select CSV file containing segment labels');
200+
if FN_labels==0 && PN_labels==0
201+
return
202+
end
194203
set(handles.path_labels,'String',strcat(PN_labels,FN_labels));
195-
function trajectories_data_path_Callback(hObject, eventdata, handles)
196-
[FN_traj,PN_traj] = uigetfile({'*.mat','MAT-file (*.mat)'},'Select MAT file containing trajectories data');
197-
set(handles.traj_path,'String',strcat(PN_traj,FN_traj));
198204
function segment_path_Callback(hObject, eventdata, handles)
199205
[FN_seg,PN_seg] = uigetfile({'*.mat','MAT-file (*.mat)'},'Select MAT file containing segmentation data');
206+
if FN_seg==0 && PN_seg==0
207+
return
208+
end
200209
error = check_object_output_dir(1, FN_seg, PN_seg);
201210
if error == 1
202211
errordlg('File path for segmentation configurations not found.','Input Error');
@@ -208,6 +217,9 @@ function segment_path_Callback(hObject, eventdata, handles)
208217
set(handles.seg_path,'String',strcat(PN_seg,FN_seg));
209218
function b_class_path_Callback(hObject, eventdata, handles)
210219
[FN_class,PN_class] = uigetfile({'*.mat','MAT-file (*.mat)'},'Select MAT file containing classification data');
220+
if FN_class==0 && PN_class==0
221+
return
222+
end
211223
error = check_object_output_dir(2, FN_class);
212224
if error == 1
213225
errordlg('File path for classification configurations not found.','Input Error');
@@ -319,10 +331,12 @@ function classify_button_Callback(hObject, eventdata, handles)
319331
[error, segmentation_configs] = select_files_default(1,rpath);
320332
if error
321333
% if not, ask for segmentation_config file
322-
segmentation_configs = select_files(1);
334+
res = select_files(1);
335+
segmentation_configs = res{1};
323336
if isempty(segmentation_configs)
324337
return
325338
end
339+
set(handles.seg_path,'String',res{2});
326340
end
327341
% see if we have the path for the labels file
328342
labels_path = get(handles.path_labels,'String');
@@ -333,6 +347,7 @@ function classify_button_Callback(hObject, eventdata, handles)
333347
if isempty(labels_path)
334348
return
335349
end
350+
set(handles.path_labels,'String',res{2});
336351
end
337352
paths = {get(handles.path_labels,'String'),...
338353
get(handles.seg_path,'String')};
@@ -479,10 +494,12 @@ function clustering_performance_Callback(hObject, eventdata, handles)
479494
[error, segmentation_configs] = select_files_default(1,rpath);
480495
if error
481496
% if not, ask for segmentation_config file
482-
segmentation_configs = select_files(1);
497+
res = select_files(1);
498+
segmentation_configs = res{1};
483499
if isempty(segmentation_configs)
484500
return
485501
end
502+
set(handles.seg_path,'String',res{2});
486503
end
487504
% see if we have the path for the labels file
488505
labels_path = get(handles.path_labels,'String');
@@ -493,6 +510,7 @@ function clustering_performance_Callback(hObject, eventdata, handles)
493510
if isempty(labels_path)
494511
return
495512
end
513+
set(handles.path_labels,'String',labels_path);
496514
end
497515
% set current GUI visibility to off
498516
temp = findall(gcf);

gui/select_files.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
return
2626
end
2727
end
28-
return_data = segmentation_configs;
28+
return_data = {segmentation_configs,[PN_group,FN_group]};
2929

3030
case 2 % labels data
3131
error = 1;
@@ -63,7 +63,7 @@
6363
return
6464
end
6565
end
66-
return_data = classification_configs;
66+
return_data = {classification_configs,[PN_group,FN_group]};
6767

6868
case 4 % folds
6969
prompt={'Choose number of folds'};

segmentation/animal_groups.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,9 @@ function save_callback(varargin)
284284
formatOut = 'yyyy-mmm-dd-HH-MM';
285285
time = datestr((time),formatOut);
286286
[file,path] = uiputfile('*.csv','Save animal groups',strcat('groups_',time));
287+
if path==0
288+
return
289+
end
287290
fid = fopen(strcat(path,file),'w');
288291
fclose(fid);
289292
% save to the new csv file the tmp_data

0 commit comments

Comments
 (0)