source: trunk/src/get_index_range.m @ 622

Last change on this file since 622 was 609, checked in by sommeria, 8 years ago

various bugs corrected after tests with Windows OS.

File size: 1.1 KB
Line 
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
13function [first_i,incr_i,last_i,first_j,incr_j,last_j,errormsg]=get_index_range(IndexRange)
14first_i=1;
15last_i=1;
16incr_i=1;
17first_j=1;
18last_j=1;
19incr_j=1;
20errormsg='';
21if isfield(IndexRange,'first_i')
22    first_i=IndexRange.first_i;
23    incr_i=IndexRange.incr_i;
24    last_i=IndexRange.last_i;
25end
26if isfield(IndexRange,'first_j')
27    first_j=IndexRange.first_j;
28    last_j=IndexRange.last_j;
29    incr_j=IndexRange.incr_j;
30end
31if last_i < first_i || last_j < first_j
32   errormsg='last field index must be larger or equal to the first one';
33end
Note: See TracBrowser for help on using the repository browser.