1 | %'get_index_range': gives the file index ranges from the input structure obtained by GUI reading |
---|
2 | % to use in Action fcts activated by 'series' |
---|
3 | %------------------------------------------------------------------------ |
---|
4 | % [first_i,incr_i,last_i,first_j,incr_j,last_j,errormsg]=get_index_range(IndexRange) |
---|
5 | % |
---|
6 | % OUTPUT: |
---|
7 | % first_i,incr_i,last_i,first_j,incr_j,last_j: values of first index,increment and last index for i and j, =1 by default |
---|
8 | % errorms: error message if the input is not in good order |
---|
9 | % |
---|
10 | % INPUT: |
---|
11 | % IndexRange: structure with possible fields first_i,incr_i,last_i,first_j,incr_j,last_j |
---|
12 | |
---|
13 | function [first_i,incr_i,last_i,first_j,incr_j,last_j,errormsg]=get_index_range(IndexRange) |
---|
14 | first_i=1; |
---|
15 | last_i=1; |
---|
16 | incr_i=1; |
---|
17 | first_j=1; |
---|
18 | last_j=1; |
---|
19 | incr_j=1; |
---|
20 | errormsg=''; |
---|
21 | if isfield(IndexRange,'first_i') |
---|
22 | first_i=IndexRange.first_i; |
---|
23 | incr_i=IndexRange.incr_i; |
---|
24 | last_i=IndexRange.last_i; |
---|
25 | end |
---|
26 | if isfield(IndexRange,'first_j') |
---|
27 | first_j=IndexRange.first_j; |
---|
28 | last_j=IndexRange.last_j; |
---|
29 | incr_j=IndexRange.incr_j; |
---|
30 | end |
---|
31 | if last_i < first_i || last_j < first_j |
---|
32 | errormsg='last field index must be larger or equal to the first one'; |
---|
33 | end |
---|