Changeset 554


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

find_file_series modified to deal with zero indices

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/find_file_series.m

    r512 r554  
    190190                end
    191191            end
     192            if i1==0
     193                i1=-1;% set index 0 to -1 to distinguish from the absent index (set to 0)
     194            end
     195            if j1==0
     196                j1=-1;% set index 0 to -1 to distinguish from the absent index (set to 0)
     197            end
    192198            i1_series(ref_i+1,ref_j+1,nb_pairs+1)=i1;
    193199            if ~isempty(i2_input)
  • 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
  • trunk/src/uvmat.m

    r552 r554  
    22952295    end
    22962296    siz=size(UvData.XmlData{1}.Time);
    2297     if ~isempty(num_i1)&& ~isempty(num_i2)&&siz(1)>=max(num_i1,num_i2) && siz(2)>=max(num_j1,num_j2)
     2297    if ~isempty(num_i1)&& ~isempty(num_i2) && num_i1>0 &&siz(1)>=max(num_i1,num_i2) && siz(2)>=max(num_j1,num_j2)
    22982298        abstime=(UvData.XmlData{1}.Time(num_i1,num_j1)+UvData.XmlData{1}.Time(num_i2,num_j2))/2;%overset the time read from files
    22992299        dt=(UvData.XmlData{1}.Time(num_i2,num_j2)-UvData.XmlData{1}.Time(num_i1,num_j1));
Note: See TracChangeset for help on using the changeset viewer.