source: trunk/src/get_file_index.m @ 1102

Last change on this file since 1102 was 1093, checked in by g7moreau, 4 years ago
  • Update Copyright to 2021
File size: 1.7 KB
Line 
1%=======================================================================
2% Copyright 2008-2021, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
3%   http://www.legi.grenoble-inp.fr
4%   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
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
19function [i1,i2,j1,j2] = get_file_index(ref_i,ref_j,PairString)
20%get the first file name set by the GUI series
21
22if iscell(PairString)
23    PairString=PairString{1};
24end
25i1=ref_i;
26j1=ref_j;
27i2=ref_i;
28j2=ref_j;
29% case of pairs
30if ~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
46end
47
48
49
50
51
Note: See TracBrowser for help on using the repository browser.