Note: This is a private function.

Read data points, data weights, indices of data to be worked on, and data tag, from the given data argument. (Used in functions that have a data input argument)


data_struct = mxe_readdata(data)
data_struct = mxe_readdata(data, false)


The output data_struct has the following fields:

  • data (n-by-N, where n is the data dimensions and N is the number of total data points) : Data matrix.
  • index (1-by-L where L is the size of the demanded subset of data points. default value: []) : Data indexing vector for selecting a subset of data (Only numeric indexing is supported. Logical indexing is not supported.)
  • weight (1-by-N, if index is empty, 1-by-L if indexing is used. default value: []) : Data weight vector,
  • size (integer): the number of data points (in the demanded subset).
  • tag (string, default value: ''): A tag for the data that can be used for special purposes.

data_struct = mxe_readdata(data) reads the given data and fills the output structure data_struct.

The given data may be a matrix, in which case it is returned untouched as, and the other fields of data_struct are set to their default values.

In case data is a structure, it may contain any of the fields mentioned above for data_struct (Note that the field is mandatory). The fields in data are copied to the output structure. If data includes a non-empty index field, this syntax applies the indexing to the data ( =,data.index)) and empties the index (data_struct.index = []).

data_struct = mxe_readdata(data, false) does not apply the indexing. Instead, returns the index for customised use. If input data is a structure without an index field (or with an empty value for index), an index refering to all the data is generated.

Note: Use this function only when you use weight or index in your function. The passed in data argument can be passed out to other functions intact, when weight or index are not used in your function.

Note: In MATLAB versions R2011b and above, instead of the data matrix, you can give a object referring to a MAT-file containing a variable named data with specifications as pointed out above.