Changeset 138


Ignore:
Timestamp:
Nov 26, 2010, 5:44:41 AM (13 years ago)
Author:
sommeria
Message:

bug repair for name generation in case of constant name (no indexing)

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/name2display.m

    r122 r138  
    7474%case of a numerical index follewed by a lower case letter (e.g. a,b,c):
    7575%the penultimate character is a number and the last one a letter (lower case: last >= 97 && last <= 122
    76 %                                                                 capital letter:  last >= 65 && last <= 90)                                                             
    77 elseif  penult >= 48 && penult <= 57 && (last >= 65 && last <= 90)||(last >= 97 && last <= 122)
     76%                                                                 capital
     77%                                                                 letter:  last >= 65 && last <= 90) 
     78elseif  penult >= 48 && penult <= 57 && ((last >= 65 && last <= 90)||(last >= 97 && last <= 122))
    7879    str_a=last_str; %extract appendix a,b,c... or A,B,C... as output.
    7980    ind_end=indcur-1; %current index just before the suffix letter
     
    129130elseif strcmp(filelit(end),'_')
    130131    indcur=separ3-1;
    131 %     field_count=num3;
    132132    str2='';
    133133    str_a='';
    134134    %detect zeros before the number
    135 %     count=0; % extract the numerical appendix
    136135    field_count=RootFile(separ3+1:end);% set the selected field number'%03d'
    137136    charstring=['%0' num2str(length(field_count)) 'd'];
    138137    nom_type=['_' num2str(1,charstring)];
    139 %     if strcmp('0',RootFile(separ3+1)); % select the non-numerical characters
    140 %         nom_type=['_%0' num2str(length(RootFile(separ3+1:end))) 'd'];
    141 %     else
    142 %         nom_type='_i';
    143 %     end 
    144      
    145138elseif RootFile(indcur-2)=='_'% search appendix a,b,c,d
    146     last=RootFile(indcur-1:indcur);
    147     if isequal(length(last),2)
    148           str_a=last(1);%put appendix a,b,c, ou d
    149           str_b=last(2);%put appendix a,b,c, ou d
    150 %           indcur=indcur-3;
    151           separ0=indsel(end-3);
     139    lasts=RootFile(indcur-1:indcur);
     140%     if isequal(length(last),2)
     141        str_a=lasts(1);%put appendix a,b,c, ou d
     142        str_b=lasts(2);%put appendix a,b,c, ou d
     143        separ0=indsel(end-3);
    152144        field_count=RootFile(separ0+1:separ1-1);
    153145        indcur=separ0;
    154         if double(last) >= 97 & double(last)<= 122
     146        if double(lasts) >= 97 & double(lasts)<= 122
    155147            nom_type='_ab';
    156148            testsub=1;
    157         elseif double(last) >= 65 & double(last) <= 90
     149        elseif double(lasts) >= 65 & double(lasts) <= 90
    158150            nom_type='_AB';
    159151            testsub=1;
     
    161153        charstring=['%0' num2str(length(field_count)) 'd'];
    162154        nom_type=[num2str(1,charstring) nom_type];
    163     end
     155%     end
    164156%search for other names with counter
    165157else
     
    178170                charstring=['%0' num2str(length(field_count)) 'd'];
    179171                nom_type=num2str(1,charstring);
    180 %                 if isequal(field_count(1),'0')
    181 %                     nbfigures=length(field_count);
    182 %                     nom_type=['%0' num2str(nbfigures) 'd'];
    183 %                 else
    184 %                     nom_type='#';
    185 %                 end
    186172            end
    187173    end
  • trunk/src/name_generator.m

    r127 r138  
    8585    nom_type_mod=nom_type;
    8686    num_j_str='';
    87     if strcmp(nom_type(1),'_')
    88         filename=[filename '_'];
    89         nom_type_mod(1)=[];
    90     end
    91     if strcmp(nom_type_mod(end),'a')
    92         nom_type_mod(end)=[];
    93         num_j_str=char(num_j1+96);% lower letter corresponding to the index
    94     elseif strcmp(nom_type_mod(end),'A')
    95         nom_type(end)=[];
    96         num_j_str=char(num_j1+64);% lower letter corresponding to the index
    97     elseif isequal(numel(regexp(nom_type_mod,'_')),1)%if a second separator '_' exists in nom_type
    98         num_j_str=['_' num2str(num_j1)];
    99         nom_type_mod(regexp(nom_type_mod,'_'):end)=[];
     87    if strcmp(nom_type,'1')
     88        filename=[filename num2str(num_i1) ext];
     89    elseif length(nom_type)<=1%fixed name , no indexing, for instance '*'
     90        filename=[filename ext];
    10091    else
    101         num_j1_out=[];%no index j
    102     end
    103     if ~isnan(str2double(nom_type_mod))   
    104         numtype=['%0' num2str(length(nom_type_mod)) 'd'];%indicate the number of digits (0 before the number)
    105         filename=[filename num2str(num_i1,numtype) num_j_str ext];
    106         num_i2_out=num_i1_out;
    107         num_j2_out=num_j1_out;
    108     else %fixed name , no indexing, for instance '*'
    109 %           filebasesub=filebase;
    110         filename=[filename ext];
     92        nom_type_mod=nom_type;
     93        if strcmp(nom_type(1),'_')
     94            filename=[filename '_'];
     95            nom_type_mod(1)=[];
     96        end
     97        if strcmp(nom_type_mod(end),'a')
     98            nom_type_mod(end)=[];
     99            num_j_str=char(num_j1+96);% lower letter corresponding to the index
     100        elseif strcmp(nom_type_mod(end),'A')
     101            nom_type(end)=[];
     102            num_j_str=char(num_j1+64);% lower letter corresponding to the index
     103        elseif isequal(numel(regexp(nom_type_mod,'_')),1)%if a second separator '_' exists in nom_type
     104            num_j_str=['_' num2str(num_j1)];
     105            nom_type_mod(regexp(nom_type_mod,'_'):end)=[];
     106        else
     107            num_j1_out=[];%no index j
     108        end
     109        if ~isnan(str2double(nom_type_mod))   
     110            numtype=['%0' num2str(length(nom_type_mod)) 'd'];%indicate the number of digits (0 before the number)
     111            filename=[filename num2str(num_i1,numtype) num_j_str ext];
     112            num_i2_out=num_i1_out;
     113            num_j2_out=num_j1_out;
     114        else %fixed name
     115            filename=[filename ext];
     116        end
    111117    end
    112118
Note: See TracChangeset for help on using the changeset viewer.