[809] | 1 | %======================================================================= |
---|
[1126] | 2 | % Copyright 2008-2024, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France |
---|
[809] | 3 | % http://www.legi.grenoble-inp.fr |
---|
[1127] | 4 | % Joel.Sommeria - Joel.Sommeria (A) univ-grenoble-alpes.fr |
---|
[809] | 5 | % |
---|
| 6 | % This file is part of the toolbox UVMAT. |
---|
| 7 | % |
---|
| 8 | % UVMAT is free software; you can redistribute it and/or modify |
---|
| 9 | % it under the terms of the GNU General Public License as published |
---|
| 10 | % by the Free Software Foundation; either version 2 of the license, |
---|
| 11 | % or (at your option) any later version. |
---|
| 12 | % |
---|
| 13 | % UVMAT is distributed in the hope that it will be useful, |
---|
| 14 | % but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | % GNU General Public License (see LICENSE.txt) for more details. |
---|
| 17 | %======================================================================= |
---|
| 18 | |
---|
[718] | 19 | function [i1,i2,j1,j2] = get_file_index(ref_i,ref_j,PairString) |
---|
| 20 | %get the first file name set by the GUI series |
---|
| 21 | |
---|
| 22 | if iscell(PairString) |
---|
| 23 | PairString=PairString{1}; |
---|
| 24 | end |
---|
| 25 | i1=ref_i; |
---|
| 26 | j1=ref_j; |
---|
| 27 | i2=ref_i; |
---|
| 28 | j2=ref_j; |
---|
| 29 | % case of pairs |
---|
| 30 | if ~isempty(PairString) |
---|
| 31 | r=regexp(PairString,'(?<mode>(Di=)|(Dj=)) -*(?<num1>\d+)\|(?<num2>\d+)','names'); |
---|
| 32 | if isempty(r) |
---|
| 33 | r=regexp(PairString,'(?<num1>\d+)(?<mode>-)(?<num2>\d+)','names'); |
---|
| 34 | end |
---|
| 35 | switch r.mode |
---|
| 36 | case 'Di=' % case 'series(Di)') |
---|
| 37 | i1=ref_i-str2num(r.num1); |
---|
| 38 | i2=ref_i+str2num(r.num2); |
---|
| 39 | case 'Dj=' % case 'series(Dj)' |
---|
| 40 | j1=ref_j-str2num(r.num1); |
---|
| 41 | j2=ref_j+str2num(r.num2); |
---|
| 42 | case '-' % case 'bursts' |
---|
| 43 | j1=str2num(r.num1)*ones(size(ref_i)); |
---|
| 44 | j2=str2num(r.num2)*ones(size(ref_i)); |
---|
| 45 | end |
---|
| 46 | end |
---|
| 47 | |
---|
| 48 | |
---|
| 49 | |
---|
| 50 | |
---|
| 51 | |
---|