MATLAB Python

zoneTest

Syntax

[resp, resp_str] = zoneTest(curr_val, respmap)

Description

Whereas other functions, such as easyKeys, can test whether particular inputs were selected, ZONETEST examines whether some current input value curr_val falls within any of the critical response ranges defined within respmap. This range can span any number of dimensions: for instance, ZONETEST can check whether inputs fall within a span, square, cube, or cube series. The only requirement is that dimensionality of curr_val and the zone options are the same.

Usage

ZONETEST must be called with both curr_val and respmap. curr_val: any numeric array corresponding to some input information. respmap: a respmap as produced by makeMap (see help makeMap). Briefly, the respmap contains a series of response options consisting of a label, response value, and the input needed to select that response. The zone information must be provided in respmap.input with a structure of [all_dims_ll all_dims_ul]. That is, all dimensions are described successively in terms of their lower limit in the first half of the vector, before being described in terms of their upper limit. For example, to define the range 2 to 5, we would specify (1, :) = [2 5]. To know if the point {2,3} fell within the rectangle bounded by points 3,5 and 2,6, we would specify (1, :) = [3 2 5 6].

Output

resp: when curr_val falls within a pre-defined zone, a scalar containing the value from respmap.values will be returned. When multiple zones match, a value from the first zone to be defined in respmap will be returned. When no zones match, resp will be set to NaN. resp_str: when curr_val falls within a pre-defined zone, resp_str will be set to the string output from respmap.descriptors. When multiple zones match, a string from the first zone to be defined in respmap will be returned. When no zones match, resp_str will be set to NR.