getcolnames

Purpose

Returns the column variable names.

Format

varnames = getColNames(X[, columns])
Parameters:
  • X (NxK dataframe.) – data with metadata.

  • columns (Kx1 vector) – Optional argument, the indices of the columns in X to get variable names of. Default = all columns.

Returns:

varnames (Kx1 string array) – Variable names in matrix X for the columns specified by columns.

Examples

// Load data
fname = getGAUSSHome("examples/yarn.xlsx");
yarn = loadd(fname, "cat(yarn_length) + cat(amplitude) + cat(load) + cycles");

// Get column names for first and second
// column in yarn
getColNames(yarn, 1|2);

The code above prints the following:

yarn_length
amplitude

See also

Functions dfname()