Commit 10a1a7f265c3cc278a61bcb2a74ca3202f0360a8

Authored by Jean-Luc Shaw
1 parent 82579848
Exists in master

Fixed zero length working data structure bug.

lib/but_bathy_filter_Callback.m
... ... @@ -9,15 +9,24 @@ if isfield(S,'z')
9 9 S.lat(I) = [] ;
10 10 S.dnum(I) = [] ;
11 11 S.z(I) = [] ;
  12 + N = numel(S.dnum) ; % track size
12 13 If = str2num(handles.edit_If.String) ;
13 14 I0 = str2num(handles.edit_I0.String) ;
14   - nIf = str2num(handles.edit_If.String) - numel(I) ;
15   - handles.edit_If.String = num2str(nIf) ;
16   - guidata(hObject, handles);
17   - update_plots(hObject, eventdata, handles) ;
  15 + if N > 2
  16 + nIf = str2num(handles.edit_If.String) - numel(I) ;
  17 + handles.edit_If.String = num2str(nIf) ;
  18 + guidata(hObject, handles);
  19 + update_plots(hObject, eventdata, handles) ;
  20 + else
  21 + handles.edit_I0.String = '1' ;
  22 + handles.edit_If.String = '1' ;
  23 + axes(handles.ax_track) ; cla;
  24 + axes(handles.ax_aux_data) ; cla;
  25 + guidata(hObject, handles);
  26 + end
  27 +
18 28  
19 29 % write to logfile
20   - N = numel(S.dnum) ; % track size
21 30 fprintf(handles.logfid,'%s,%d,%d,%f,%d\n','bathy_filter',I0,If,zmin,N) ;
22 31 else
23 32 msgbox('No z computed for GPS track. Load bathymetry file!')
... ...
lib/but_delete_Callback.m
... ... @@ -17,13 +17,20 @@ fprintf(handles.logfid,'%s,%d,%d,%f,%d\n','delete',I0,If,nan,newN) ;
17 17  
18 18 %% Update plots zooming out
19 19 N = numel(S.dnum) ;
20   -I0 = 1 ;
21   -If = N ;
22   -handles.edit_I0.String = '1' ;
23   -handles.edit_If.String = num2str(N) ;
24   -
25   -guidata(hObject, handles);
26   -update_plots(hObject, eventdata, handles) ;
  20 +if N > 2
  21 + I0 = 1 ;
  22 + If = N ;
  23 + handles.edit_I0.String = '1' ;
  24 + handles.edit_If.String = num2str(N) ;
  25 + guidata(hObject, handles);
  26 + update_plots(hObject, eventdata, handles) ;
  27 +else
  28 + handles.edit_I0.String = '1' ;
  29 + handles.edit_If.String = '1' ;
  30 + axes(handles.ax_track) ; cla;
  31 + axes(handles.ax_aux_data) ; cla;
  32 + guidata(hObject, handles);
  33 +end
27 34  
28 35 % Update handles structure
29 36 guidata(hObject, handles);
... ...
lib/but_punch_out_Callback.m
... ... @@ -39,14 +39,21 @@ newN = numel(S.dnum) ; % track size
39 39 fprintf(handles.logfid,'%s,%d,%d,%f,%d\n','output',I0,If,cnt-1,newN) ;
40 40  
41 41 %% Update plots zooming out
42   -N = numel(S.dnum) ;
43   -I0 = 1 ;
44   -If = N ;
45   -handles.edit_I0.String = '1' ;
46   -handles.edit_If.String = num2str(N) ;
  42 +if newN > 2
  43 + N = numel(S.dnum) ;
  44 + I0 = 1 ;
  45 + If = N ;
  46 + handles.edit_I0.String = '1' ;
  47 + handles.edit_If.String = num2str(N) ;
47 48  
48   -guidata(hObject, handles);
49   -update_plots(hObject, eventdata, handles) ;
  49 + guidata(hObject, handles);
  50 + update_plots(hObject, eventdata, handles) ;
  51 +else
  52 + handles.edit_I0.String = '1' ;
  53 + handles.edit_If.String = '1' ;
  54 + axes(handles.ax_track) ; cla;
  55 + axes(handles.ax_aux_data) ; cla;
  56 +end
50 57  
51 58 % Reset flag radio buttons
52 59 handles.rad_flag_deploy.Value = false;
... ...