3.4 LabTalk-Supported Origin C FunctionsLT-Supported-OC-Functions
The following functions are implemented in the following file which is shipped with Origin:
<exe>\OriginC\System\internal.c
To suggest new functions, please contact Originlab(via:featurerequest@originlab.com).
String
- int Compare(string str1, string str2 [, int CaseSensitivity])
- to compare str1 with str2, identical will return 1.
See the details.
- string Char(int number)
- returns the character specified by the code number.
See the details.
- int Code(string str)
- returns a numeric code for the first character in input string
See the details.
- int Find(string str1, string str2 [, int StartPos = 1])
- return location of a substring(str2) in a string(str1). The search is case-sensitive. To do case insensitive search, use the Search function.
See the details.
- int Search(string str1, string str2 [, int StartPos = 1])
- return the location of a substring(str2) in a string(str1). the search is NOT case-sensitive. To do case-sensitive search, use the Find function.
See the details.
- int MatchBegin(string str1, string str2 [, int StartPos = 1, int CaseSensitivity])
- return the beginning location of a substring in a string(str1) by using a string pattern(str2) containing wildcard characters like * or ?.
See the details.
- int MatchEnd(string str1, string str2 [, int StartPos = 1, int CaseSensitivity])
- return the ending location of a substring in a string(str1) by using a string pattern(str2) containing wildcard characters like * or ?.
See the details.
- int Len(string str)
- return the length of a string
See the details.
- string Trim(string str, int n)
- Trim spaces from string, options include
0 (default)
|
Trim leading and trailing spaces
|
1
|
Trim all spaces, including those inside the string
|
See the details.
- string Right(string str, int n)
- Returns right-most n characters
See the details.
- string Left(string str,int n)
- Returns left-most n characters
See the details.
- string Mid(string str,int n1,int n2)
- Returns n2 characters of string starting from n1th position (numbered from 1)
See the details.
- string Upper(string str)
- convert to UPPERCASE
See the details.
- string Lower(string str)
- CONVERT TO lowercase
See the details.
- INT Exact(string str1, string str2)
- Returns TRUE if both strings are an exact match (case and length)
See the details.
- string Replace(string string1,int n1,int n2,string string2)
- Replace n2 characters in string1 starting at n1th position with string2. String2 may be different length than n2.
See the details.
- string Substitute(string string1, string string2, string string3 [,int n = 0])
- Substitute string3 with string2 when found in string1. n=0 Substitute all, otherwise only nth instance.
See the details.
- string Format(double data, string fmt = "*")
- convert double to string with LabTalk formatting option. Formatting option default is "*" will use @SD significant digits, "*3" will show as 3 significant digits.
See the details.
Math
- double asinh(double x)
- returns the inverse hyperbolic sine.
See the details.
- double acosh(double x)
- returns the inverse hyperbolic cosine.
See the details.
- double atanh(double x)
- returns the inverse hyperbolic tangent.
See the details.
- double Degrees(double angle)
- converts radians into degrees.
See the details.
- double Radians(double angle)
- converts degrees into radians.
See the details.
- double Distance(double x1, double y1, double x2, double y2)
- returns the distance between two points.
See the details.
- double Distance3D(double x1, double y1, double z1, double x2, double y2, double z2)
- returns the distance between two points in Cartesian XYZ space.
See the details.
- double Angleint1(double x1, double y1, double x2, double y2 [, int unit = 0, int direction = 0])
- returns angle between a line through the two points(x1, y1) and (x2, y2) with the X axis. Returns degrees if unit=1 or radians if unit=0, default is radians. direction specifies the direction of the return value. 0 constrains the value to the first (+x,+y) and fourth (+x,-y) quadrant. 1 returns values from 0 to 2PI radians or 0 to 360 degrees.
See the details.
- double Angleint2 (double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4 [, int unit = 0, int direction = 0])
- returns the angle between two lines measured from angle of second line to the angle of the first line. Returns degrees if unit=1 or radians if unit=0, default is radians. direction specifies the direction of the return value. 0 constrains the value to the first (+x,+y) and fourth (+x,-y) quadrant. 1 returns values from 0 to 2PI radians or 0 to 360 degrees.
See the details.
Statistics
- double Median(vector<double> vdData [, int nInterpolation = 0])
- returns median of vdData with nInterpolation. The value of nInterpolation same as the option Computation Control -> Interpolation of Quantiles on Statistics on Column dialog.
See the details.
- double Min(vector v)
See the details.
- double Max(vector v)
See the details.
- double Mean(vector v)
- Returns the average of a vector
See the details.
- double Total(vector v)
- Returns the sum of a vector
See the details.
- double StdDev(vector v)
- The Sample Standard Deviation
See the details.
- double StdDevP(vector v)
- The Population Standard Deviation
See the details.
- int Count(vector v,int n)
- Counts elements in a vector
See the details.
0 (default)
|
Counts the number of elements in the vector, size of the vector
|
1
|
Counts the number of Numeric Values
|
2
|
Counts the number of Missing Values
|
3
|
Counts the number of Text Values (future work)
|
4
|
Counts the number of Blanks (future work)
|
Date and Time
In the following
d is a Date Value which can include Time
t is a Time value
n is an integer value, typically optional
- int WeekDay(double d,int n)
- Return 1,2,3 etc for day of the week, with second arg(n) of
0 (default)
|
Returns 0 (Sunday) through 6 (Saturday) [Same as Origin DayOfWeek]
|
1
|
Returns 1 (Sunday) through 7 (Saturday)
|
2
|
Returns 0 (Monday) through 6 (Sunday)
|
3
|
Returns 1 (Monday) through 7 (Sunday)
|
See the details.
- int WeekNum(double d,int option)
- Returns 1 to 53, indicating the calendar week number of the year
1 (default)
|
Week starts on Sunday
|
2
|
Week starts on Monday
|
See the details.
- int Year(double d)
- Returns the year as an integer in the range 0100-9999
See the details.
- int Month(double d)
- Returns the month as an integer from 1 (January) to 12 (December)
See the details.
- string MonthName(double d,int n)
- Returns the Month name for specified month by index of 1 to 12, or as a Date value.
1
|
Returns single character : J, F, etc.
|
3 (default)
|
Returns 3 characters : Jan, Feb, etc.
|
0
|
Returns full name : January, February, etc.
|
-1
|
Returns 3 character English name regardless of the current language used
|
See the details.
- string YearName(double d,int n)
- Returns the year in string form with input of year or date, with option n
0
|
Returns two digits, like 98, 08
|
1 (default)
|
Returns two digits, like '98, '08
|
2
|
Returns full 4 digits year, 1998, 2008
|
See the details.
- int Day(double d,int n)
- Returns the day number of a given date where option can be
1 (default)
|
Returns Day of Month : 1 to 31
|
2
|
Returns Day of Year : 1 to 366
|
See the details.
- int Hour(double d)
- Returns the hour as an integer, ranging from 0 (12:00 A.M.) to 23 (11:00 P.M.).
See the details.
- int Hour(double t)
- Returns the hour as an integer, ranging from 0 (12:00 A.M.) to 23 (11:00 P.M.).
See the details.
- int Minute(double d)
- Returns the minutes as an integer, ranging from 0 to 59.
See the details.
- int Minute(double t)
- Returns the minutes as an integer, ranging from 0 to 59.
See the details.
- double Second(double d, int n)
- Returns the seconds as a real value in the range 0 (zero) to 59.9999...
0 (default)
|
Return seconds with more digits.
|
1
|
Return seconds with 3 digits.
|
See the details.
- double Second(double t)
- Returns the seconds as a real value in the range 0 (zero) to 59.9999...
See the details.
- double Now()
- Returns the current date-time as a date (Julian days) value.
See the details.
- double Today()
- Returns the current date as a date (Julian days) value.
See the details.
- double Quarter(double date)
- Returns 1,2,3,4 with date argument.
See the details.
Bitwise Operators
- BitAND
- Return bitwise AND operation of two integers.
See the details.
- BitOR
- Return bitwise OR operation of two integers.
See the details.
- BitXOR
- Return bitwise XOR operation of two integers.
See the details.
Not-a-Number (NANUM) Functions
- ISNA
- Determines whether the argument is a NANUM.
See the details.
- NA
- Returns NANUM.
See the details.
|