Changeset 554 for trunk/src/series.m


Ignore:
Timestamp:
Oct 17, 2012, 10:36:43 PM (12 years ago)
Author:
sommeria
Message:

find_file_series modified to deal with zero indices

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series.m

    r553 r554  
    593593
    594594%% display the min and max indices for the file series
    595 if size(i1_series,2)==1
     595if size(i1_series,2)==2 && min(min(i1_series(:,1,:)))==0
    596596    MinIndex_j=1;
    597     MaxIndex_j=1; 
    598     MinIndex_i=min(find(i1_series));
    599     MaxIndex_i=max(find(i1_series));
    600 else
    601 pair_max=squeeze(max(i1_series,[],1)); %max on pair index
    602 j_max=max(pair_max,[],1);
    603 %i_sum=sum(sum(i1_series,2),1);%sum of i1_series on the last index
    604 MaxIndex_i=max(find(j_max))-1;% max ref index i
    605 MinIndex_i=min(find(j_max))-1;% min ref index i
    606 diff_i_max=diff(j_max);
     597    MaxIndex_j=1;
     598    MinIndex_i=find(i1_series(:,2,:), 1 )-1;
     599    MaxIndex_i=find(i1_series(:,2,:), 1, 'last' )-1;
     600else
     601    pair_max=squeeze(max(i1_series,[],1)); %max on pair index
     602    j_max=max(pair_max,[],1);
     603    %i_sum=sum(sum(i1_series,2),1);%sum of i1_series on the last index
     604    MaxIndex_i=find(j_max, 1, 'last' )-1;% max ref index i
     605    MinIndex_i=find(j_max, 1 )-1;% min ref index i
     606    diff_i_max=diff(j_max);
    607607    if isequal (diff_i_max,diff_i_max(1)*ones(size(diff_i_max)))
    608608        set(handles.num_incr_i,'String',num2str(diff_i_max(1)))
    609609    end
    610 i_max=max(pair_max,[],2);
    611 MaxIndex_j=max(find(i_max))-1;% max ref index i
    612 MinIndex_j=min(find(i_max))-1;% min ref index i
    613 diff_j_max=diff(i_max);
     610    i_max=max(pair_max,[],2);
     611    MaxIndex_j=max(find(i_max))-1;% max ref index i
     612    MinIndex_j=min(find(i_max))-1;% min ref index i
     613    diff_j_max=diff(i_max);
    614614    if isequal (diff_j_max,diff_j_max(1)*ones(size(diff_j_max)))
    615615        set(handles.num_incr_j,'String',num2str(diff_j_max(1)))
     
    618618MinIndex=get(handles.MinIndex,'Data');%retrieve the min indices in the table MinIndex
    619619MaxIndex=get(handles.MaxIndex,'Data');%retrieve the max indices in the table MaxIndex
     620if isequal(MinIndex_i,-1)
     621    MinIndex_i=0;
     622end
     623if isequal(MinIndex_j,-1)
     624    MinIndex_j=0;
     625end
    620626MinIndex{iview,1}=MinIndex_i;
    621627MinIndex{iview,2}=MinIndex_j;
     
    743749            TimeTable{iview,1}=time(MinIndex_i,MinIndex_j);
    744750        end
    745         TimeTable{iview,2}=time(first_i,first_j);
    746         TimeTable{iview,3}=time(last_i,last_j);
     751        if size(time)>=[last_i last_j]
     752            TimeTable{iview,2}=time(first_i,first_j);
     753            TimeTable{iview,3}=time(last_i,last_j);
     754        end
    747755        if size(time)>=[MaxIndex_i MaxIndex_j];
    748         TimeTable{iview,4}=time(MaxIndex_i,MaxIndex_j);
     756            TimeTable{iview,4}=time(MaxIndex_i,MaxIndex_j);
    749757        end
    750758    end
Note: See TracChangeset for help on using the changeset viewer.