Ignore:
Timestamp:
Apr 11, 2024, 7:30:52 PM (15 months ago)
Author:
sommeria
Message:

updated to read pivdata from fluidimage

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/fileparts_uvmat.m

    r1127 r1131  
    9494            delim2=r.delim2;
    9595            num3=r.num3;
     96            ipair=1;
     97            jpair=1;
    9698            switch delim1
    9799                case '_'
     
    101103                            i1=str2double(num3);
    102104                            i2=str2double(num2);
     105                            if i2<=i1
     106                                ipair=0;
     107                            end
    103108                    end
    104109                case '-'
    105110                    j1=str2double(num2);
    106111                    j2=str2double(num1);
     112                    if j2<=j1
     113                                jpair=0;
     114                    end
    107115                    switch delim2
    108116                        case '_'
     
    110118                    end
    111119            end
     120            if ipair && jpair
    112121            NomType=[get_type(num3) delim2 get_type(num2) delim1 get_type(num1)];
    113122            RootFile=regexprep(FileName,[num3 delim2 num2 delim1 num1 '$'],'');
     123            else
     124                if ipair==0
     125                    i1=i2;
     126                    i2=[];
     127                    NomType=[get_type(num2) delim1 get_type(num1)];
     128                    RootFile=regexprep(FileName,[ num2 delim1 num1 '$'],'');
     129                elseif jpair==0
     130                    j1=j2;
     131                    j2=[];
     132                    NomType=get_type(num1);
     133                    RootFile=regexprep(FileName,[num1 '$'],'');
     134                end
     135            end
     136       
    114137        else
     138            ipair=1;
    115139            switch delim1
    116140                case '_'
     
    120144                    i1=str2double(num2);
    121145                    i2=str2double(num1);
    122             end
     146                    if i2<=i1
     147                        ipair=0;
     148                    end
     149            end
     150            if ipair
    123151            NomType=[get_type(num2) delim1 get_type(num1)];
    124152            RootFile=regexprep(FileName,[num2 delim1 num1 '$'],'');
     153            else
     154                i1=i2;
     155                i2=[];% no pair detected if i2<=i1
     156                NomType= get_type(num1);
     157            RootFile=regexprep(FileName,[ num1 '$'],'');
     158            end
    125159        end
    126160        NomType=regexprep(NomType,'-1','-2'); %set 1-2 instead of 1-1
     
    152186
    153187%% suppress '_' at the end of RootFile, put it on NomType
    154 % if strcmp(RootFile(end),'_')
    155 %     RootFile(end)=[];
    156 detect=regexp(RootFile,'_$'); %detect '_' at the end of RootFILE
     188detect=regexp(RootFile,'_$','once'); %detect '_' at the end of RootFILE
    157189if ~isempty(detect)
    158190    RootFile=regexprep(RootFile,'_$','');
     
    161193
    162194%% extract subdirectory for pairs i1-i2 or j1-j2 (or ab, AB)
    163 % if ~isempty(i2) || ~isempty(j2)
    164195    r=regexp(RootPath,'\<(?<newrootpath>.+)(\\|/)(?<subdir>[^\\^/]+)(\\|/)*\>','names');
    165196    if ~isempty(r)
     
    167198        RootPath=r.newrootpath;
    168199    end
    169 % end
    170200
    171201
Note: See TracChangeset for help on using the changeset viewer.