Index: /trunk/src/get_field.m
===================================================================
--- /trunk/src/get_field.m	(revision 755)
+++ /trunk/src/get_field.m	(revision 756)
@@ -587,5 +587,5 @@
 test_coord=zeros(size(Field.Display.VarDimName)); %=1 when variable #ilist is eligible as structured coordiante
 dim_var=Field.Display.VarDimName{scalar_index};%list of dimensions of the selected variable
-if ~get(handles.CheckDimensionX,'Value')  || ~get(handles.CheckDimensionY,'Value')
+if ~get(handles.CheckDimensionX,'Value')  
     %look for coordinate variables among the other variables
     for ilist=1:numel(Field.Display.VarDimName)
@@ -990,5 +990,8 @@
 MenuIndex=get(handles.TimeName,'Value');
 string=get(handles.TimeName,'String');
+TimeName='';%default
+if ~isempty(string)&&iscell(string)
 TimeName=string{MenuIndex};
+end
 switch index
     case 1
@@ -1001,4 +1004,6 @@
             AttrName=Field.ListGlobalAttribute{attr_index};
             set(handles.TimeUnit,'String',Field.(AttrName))
+        else
+            set(handles.TimeUnit,'String','')
         end
     case {3 ,4}
Index: /trunk/src/nc2struct.m
===================================================================
--- /trunk/src/nc2struct.m	(revision 755)
+++ /trunk/src/nc2struct.m	(revision 756)
@@ -261,7 +261,11 @@
             if input_index==4% if a dimension is selected as time
                 ind_vec=zeros(1,numel(var_dim{ivar}));% vector with zeros corresponding to al the dimensions of the variable VarName
-                ind_size=dim_value(var_dim{ivar});% vector giving the size of the variable VarName
+                ind_size=dim_value(var_dim{ivar});% vector giving the size (for each dimension) of the variable VarName
                 index_time=find(var_dim{ivar}==TimeDimIndex);
                 if ~isempty(index_time)
+                    if ind_size(index_time)<max(TimeIndex)
+                        errormsg=['requested index ' num2str(TimeIndex) ' exceeds matrix dimension'];
+                        return
+                    end
                     ind_vec(index_time)=TimeIndex-1;% selected index(or indices) to read
                     ind_size(index_time)=numel(TimeIndex);%length of the selected set of time indices
