tan - return tangent

Syntax: float tan(float x)
Description: Returns the tangent of each member in x.
  • x must be specified in radians. If it is in degrees use tan(x/180*pi)
Examples: x tan(x)
-π/2
-π/4
0
π/4
π/2
!!
1
0

!!
Code sample:
reset all;
x = range(-pi*2//pi*2,121);
y = tan(x);
y = if(abs(y)>100,undef,y);

create Viewport page_1.viewport_1;
create Domain page_1.viewport_1.domain_1;
create Graph page_1.viewport_1.domain_1.graph_1
   ( XuNxData = "x",
     XuNyData = "y"
   );
See also: atan, cos, sin

tanh - return hyperbolic tangent

Syntax: float tanh(float x)
Description: Returns the hyperbolic tangent of each member in x.
  • x must be specified in radians. If it is in degrees use cosh(x/180*pi)

 

See also: tan

time - return the time

Syntax: time
Description: Returns the current time
  • time should not be followed by parentheses i.e. "()".
  • time returns a variable of type time
Code sample:
time1 = secsince(time);
x = input_float("What is 3+3?",6,6,1);
time2 = secsince(time);
echo("It took you "+(time2-time1)+" seconds to get the right answer");
See also: today

timeformat1 - convert string to time

Syntax: time timeformat1(string t)
Description: Converts a string dataset to a time dataset.
  • input strings can be in any of the following formats: HH:MM:SS, HH-MM-SS, HH/MM/SS and HH-MM/SS
Examples: t timeformat1(t)
23:58:00
23-58-00
23/58/00
23-58/00
23:58:00
23:58:00
23:58:00
23:58:00
See also: secsince, invsecsince

tmpnam - name of temporary file

Syntax: string tmpnam()
Description: Return a unique filename that can be used as a temporary file.
  • On Windows tmpnam() returns the name of a temporary file in the root directory. If you would rather use a file in C:\Windows\TEMP then use:

    "C:\\Windows\\TEMP"+tmpnam() or

    getenv("TEMP")+tmpnam();

    if you have the TEMP environment variable set on your system.

See also: getpid

todate - create dates

Syntax: date todate(float year, float month, float day)
Description: Create a date dataset from the year, month and day datasets.
Example: todate(1970,6,29)
29-JUN-1970
Code sample:
June = todate(1970,6,1:30);
See also: yearnumber, monthnumber, daynumber

today - returns today's date

Syntax: today
Description: Returns today's date
  • today should not be followed by parentheses i.e. "()".
  • today returns a variable of type date.
  • date works in exactly the same way as today. e.g. d = date;
Code sample:
next30days = invdaysince(daysince(today)+(1:30));
See also: time

toggle_immutable - toggle the immutable resource of an object

Syntax: toggle_immutable(string object)
Description:

Toggle the immutable resource of object. If the immutable resource is set to true then the object's resources cannot be modified.

  • Since Gsharp 3.3 the immutable resource can only be set or unset from GSL.
Code sample:
set page_1
   ( XuNlockToDevice = true
   );
toggle_immutable("page_1");

tokenize - tokenize string

Syntax: string tokenize(string s, string separators)
Description: Return all substrings (tokens) of s which are delimited by the string separators
  • Multiple characters are allowed in separators
Example: tokenize("parse this line"," ");
"parse"//"this"//"line"

tolower - convert to lower case

Syntax: string tolower(string s)
Description: Return s with all characters in lower case
Example: tolower("Gsharp is made by AVS ");
"gsharp is made by avs"
See also: toupper

tostring - convert number to string

Syntax: string tostring(float x)
Description:

Converts the number x into a string.

  • If you want to control the format used then use either valuestr or sprintf
  • It may be quicker to use ""+x
Code Sample :
#convenience function for setting a text object to a float
function GuiSetFloat(string o, float v, float cb)
  GuiSetString(o, tostring(v), cb);

endfunction
See also: valuestr, sprintf

totime - create times

Syntax: date totime(float hour, float minute, float second)
Description: Create a time dataset from the hour, minute and second datasets.
Example: totime(9,13,00)
9:13:00
Code sample:
minute1 = totime(0,0,0:59);
See also: hournumber, minutenumber, secondnumber

toupper - convert to upper case

Syntax: string toupper(string s)
Description: Return s with all characters in upper case
Example: toupper("Gsharp is made by AVS ");
"GSHARP IS MADE BY AVS"
See also: tolower

tovalue - convert string to number

Syntax: float tovalue(string x)
Description:

Converts the string x into a float.

  • strvalue() does the same thing.
Code Sample :
#convenience function for getting the value of a text object
function float GuiGetFloat(string o)
  return tovalue(GuiSetString(o));

endfunction
See also: strvalue, tostring

tprob - T distributed probability

Syntax: float tprob(float x, float degrees)
Description: Return the probability that a T distributed variable with degrees of freedom will have a value less than or equal to x
  • The result is accurate to approximately 4 significant digits
See also: fprob, normprob, x2prob

transpose - transpose grid

Syntax: any transpose(any x)
Description: Return the transpose of the grid/matrix x
  • The rows become columns and the columns become rows
  • transpose will work with float or string datasets.
Examples: x transpose(x)
1   2   3
4   5   6
7   8   9
1   4   7
2   5   8
3   6   9
See also: reshape, slicex

trunc - return integer part of float

Syntax: float trunc(float x)
Description:

Exactly the same as int()

See also: int

typeof - typeof object

Syntax: string typeof(object object)
Description: Return the type of the specified object
  • For GUI objects and graphic objects - the class name is returned. e.g. "Menu" or "Viewport"
  • For variables and object resources - the datatype is returned. e.g. "float" or "string".
  • functions return "Function" and folders, "Folder"
  • You must pass the object as a parameter, not as a string. e.g .typeof(page_1) not typeof("page_1") - which would return "string".
  • If you have the name of an object as a string you can pass it to typeof as an object pointer. e.g.

    OBJ = current_object();
    echo(typeof($OBJ));

Examples: object typeof(object)
page_1
page_1.XuNsize
cos
"Page"
"float"
"Function"
See also: exists, all