hist_access_buffer

hist_access_buffer — accesses buffer elements using array-like syntax.

Syntax

hist_access_buffer (buffer, index[, axis])
    

Parameters

buffer

A binary buffer of X-Y pairs of doubles, as created by a call to hist_buffer_id_read.

index

The index of the data element to retrieve from the buffer.

axis

An optional string indicating which value of the of the data pair to access, "X" or "Y".

Returns

If axis is specified, then the corresponding real-valued data at the index. If axis is not specified, then an instance of the HI_stVALUE class containing the data at the index. If an error occurs, then nil is returned and _last_error_ is set to one of the following possible errors:

"Invalid axis specifier: axis"
"Index out of range: index"
"Buffer empty"

Description

This function provides access to the elements of the buffer as if it were an array.

Example

Gamma> hist_access_buffer(buf, 2, "X");
1025721206.20266
Gamma> hist_access_buffer(buf, 2, "Y");
102.1
Gamma> hist_access_buffer(buf, 2);
{HI_stVALUE (value . 102.1) (xaxis . 1025721206.20266)}