3.5.8.4 Cattext


Description

Returns the nth category value of a Categorical column, to a worksheet column. It is the reverse function of Catindex.

Syntax

vector Cattext(int n, vector vd)$

Parameter

vd

a vector (column of categorical data) in an Origin worksheet.

Return

Returns the nth category value of a categorical column vd.

Example

EX1

//fill col(A) with "q q q w e", and set as categorical
cattext(3, col(A))$=;//e

EX2

// create an empty book
newbook; 
// import the file automobile.dat into the new book
impASC fname:="C:\Program Files\OriginLab\Origin2020b\Samples\Statistics\automobile.dat";
// set column 2 as categorical and sort it in ascending order
wks.col2.categorical.type=2;
wks.col2.categorical.sort=1;
// add a new column H and use catindex function to fill it with the corresponding category index of element in column A
// add a new column I and use cattext function to get the category string from index in column H
col(H)=catindex(col(B));
col(I)=cattext(col(H), col(B))$;

See Also

Category, Catindex, Catrows