Line | |
---|
1 | function [i1,i2,j1,j2] = get_file_index(ref_i,ref_j,PairString) |
---|
2 | %get the first file name set by the GUI series |
---|
3 | |
---|
4 | if iscell(PairString) |
---|
5 | PairString=PairString{1}; |
---|
6 | end |
---|
7 | i1=ref_i; |
---|
8 | j1=ref_j; |
---|
9 | i2=ref_i; |
---|
10 | j2=ref_j; |
---|
11 | % case of pairs |
---|
12 | if ~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 |
---|
28 | end |
---|
29 | |
---|
30 | |
---|
31 | |
---|
32 | |
---|
33 | |
---|
Note: See
TracBrowser
for help on using the repository browser.