Current Page: NeXtMidas User's Guide Files File Trimmers
| ##### File Trimmers In-line trimming is useful for accessing a subsection of a file rather than the whole thing. Unlike X-Midas, NeXtMidas uses zero based indexing; the start is inclusive and the end is exclusive. To look at a piece of a file such as the first 300 elements, or the part between 1.5 and 3.5 seconds, you could use the `THIN` command to copy the segment to a temporary file and then work with it. However, this gets time-consuming and clutters the disk. Using in-line file trimming works best. File Trimmers are of the form (START:END), where START offset is INCLUSIVE and END offset is EXCLUSIVE, appended to a file name to indicate a subset of data within the file. The colon ":" is used to separate the start and end offsets of the desired file segment to trim it on the fly. For example:
    nM> statistics abc(199:300)
This gives the statistics on points 199 (zero based index) up to but not including 300 of the file `ABC`. If the start offset is not given it defaults to the first element (zero), and leaving off the end defaults to the last element (the colon is required in either case). So, `ABC(:400)` is the first 400 elements and `ABC(400:)` is the file from element 401 to the end. If the END offset starts with a plus "+", it is a relative distance from the START offset, or the length of the segment (i.e. number of elements). If either START or END offset starts with a "-", it is the offset relative to the end of the file. Thus file(-1:+1) refers to the last element of the file. The subrange tokens (start, end or length) are assumed to be index values, unless they are preceded by a tilde ( ~ ) to make them abscissa values. A subrange token can be either a literal numeral or a numeric results parameter. Thus,
    nM> statistics def(~1.5:~3.0)
gives the statistics of the file `DEF` from 1.5 sec to 3.0 sec (if the DEF abscissa is measured in seconds). You can freely mix index and abscissa addressing: `DEF(~1.5:349)` trims DEF from 1.5 sec to index #349. Trimmers must come before qualifiers. For example:
    nM> noop adatafile(0:+nels){aux=cwd} outputfile
uses the AUX qualifier to indicate the file to be used is in the CWD (current working directory) AUX.