Changeset 756 for trunk/src/nc2struct.m


Ignore:
Timestamp:
Apr 28, 2014, 8:05:56 AM (10 years ago)
Author:
sommeria
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/nc2struct.m

    r755 r756  
    261261            if input_index==4% if a dimension is selected as time
    262262                ind_vec=zeros(1,numel(var_dim{ivar}));% vector with zeros corresponding to al the dimensions of the variable VarName
    263                 ind_size=dim_value(var_dim{ivar});% vector giving the size of the variable VarName
     263                ind_size=dim_value(var_dim{ivar});% vector giving the size (for each dimension) of the variable VarName
    264264                index_time=find(var_dim{ivar}==TimeDimIndex);
    265265                if ~isempty(index_time)
     266                    if ind_size(index_time)<max(TimeIndex)
     267                        errormsg=['requested index ' num2str(TimeIndex) ' exceeds matrix dimension'];
     268                        return
     269                    end
    266270                    ind_vec(index_time)=TimeIndex-1;% selected index(or indices) to read
    267271                    ind_size(index_time)=numel(TimeIndex);%length of the selected set of time indices
Note: See TracChangeset for help on using the changeset viewer.