source: trunk/src/get_file_index.m @ 718

Last change on this file since 718 was 718, checked in by sommeria, 10 years ago

get_file_index added

File size: 839 bytes
Line 
1function [i1,i2,j1,j2] = get_file_index(ref_i,ref_j,PairString)
2%get the first file name set by the GUI series
3
4if iscell(PairString)
5    PairString=PairString{1};
6end
7i1=ref_i;
8j1=ref_j;
9i2=ref_i;
10j2=ref_j;
11% case of pairs
12if ~isempty(PairString)
13    r=regexp(PairString,'(?<mode>(Di=)|(Dj=)) -*(?<num1>\d+)\|(?<num2>\d+)','names');
14    if isempty(r)
15        r=regexp(PairString,'(?<num1>\d+)(?<mode>-)(?<num2>\d+)','names');
16    end
17    switch r.mode
18        case 'Di='  %  case 'series(Di)')
19            i1=ref_i-str2num(r.num1);
20            i2=ref_i+str2num(r.num2);
21        case 'Dj='  %  case 'series(Dj)'
22            j1=ref_j-str2num(r.num1);
23            j2=ref_j+str2num(r.num2);
24        case '-'  % case 'bursts'
25            j1=str2num(r.num1)*ones(size(ref_i));
26            j2=str2num(r.num2)*ones(size(ref_i));
27    end
28end
29
30
31
32
33
Note: See TracBrowser for help on using the repository browser.