Cicode Programming Reference > Cicode Function Categories > Statistical Process Control Functions Introduction > SPCGetHistogramTable

SPCGetHistogramTable

Returns an array containing the frequencies of particular ranges for the given SPC tag. The histogram structure is implied in the order of the table as follows - the first array element is the data less than -3 sigma. The second value is the data between -3 sigma and -3 sigma plus the bar width etc. The last value is the data greater than +3 sigma.

This function can only be called while the SPC tag is being displayed on an SPC page.

Syntax

SPCGetHistogramTable(sSPCTag, iNoBars, TableVariable)

sSPCTag:

The SPC Tag name as defined in SPC Tags.

iNoBars:

The number of bars in the table. The valid range is restricted to values from 7 to 100. This also indicates the size of the array to be returned.

TableVariable:

The Cicode array that will store the histogram data. This variable needs to be defined as a global array of type REAL. The number of elements in the array needs to be equal to (or greater than) iNoBars.

Return Value

0 (zero) if successful, otherwise an error number is returned. The histogram table is written to TableVariable.

Related Functions

TableMath

Example

/* This function will get the maximum frequency present in the
histogram of a particular SPC tag.*/
INT iFrequency[7];
! This variable needs to be global to the file so is declared outside of the function
INT
FUNCTION
GetMaxFreq(STRING sTAG)
INT iError;
INT iMax = -1;
iError = SPCGetHistogramTable(sTag, 7, iFrequency);
!The elements of iFrequency now hold the histogram table frequencies.
IF iError = 0 THEN
! Get maximum
iMax = TableMath(iFrequency,7,1,0);
END
Return iMax;
END

See Also

SPC Functions