typecv

Purpose

Returns the symbol table type of objects whose names are given as a string or as elements of a character vector or string array.

Format

y = typecv(x)
Parameters:

x (string or Nx1 character vector or string array) – contains the names of variables whose type is to be determined.

Returns:

y (scalar or Nx1 vector) – containing the types of the respective symbols in x.

Examples

xvar = sqrt(5);
yvar = "betahat";
fn area(r) = pi*r*r;
names = { xvar, yvar, area };
y = typecv(names);

This code assigns the following to y:

     6  // 6 for type matrix
y = 13  // 13 for string
     9  // 9 for function

Remarks

The values returned by typecv() for the various variable types are as follows:

5

keyword (keyword)

6

matrix (numeric, character, or mixed)

8

procedure (proc)

9

function (fn)

13

string

15

string array

17

structure

21

array

23

structure pointer

typecv() will return the GAUSS missing value code if the symbol is not found, so it may be used to determine if a symbol is defined or not.

See also

Functions type(), typef(), varput(), varget()