Text function and Format function are equivalent except the default format used when the optional parameter fmt$ is missing, see the details in the Parameters section below. Please note that Text function is accessible from Set Column Value: F(x) menu while Format is not. However, both work via LabTalk script. If you are using version 9.1 or later, we advise using the Text function.
Text and Format convert double to string using one of these LabTalk formatting options.
string dataString = Text(double d[, string fmt$])$
string dataString = Format(double d[, string fmt$])$
d
fmt$
@SD=;
in the Script Window). For instance, the value "*3" for the string fmt$ will yield 3 significant digits in the returned string. Use "*" to use Origin's global setting.Return the numeric data as a string in the format specified by fmt$.
// specifying 3 significant figures string yy$=Text(2.01232, "*3")$; yy$=; // will return 2.01 // convert input numeric into engineering format, with 3 significant figures string str$=Format(123000, "E*3")$; str$=; //will return 123k
@SD=; // get the current value stored in @SD @SD=2; // reset the value in @SD to 2 // call text using the system default, @SD string yy$=Text(2.456789, "")$; yy$=; // returns YY = 2.5
// convert date(d/mm/yyyy) to string in U.S. Regional settings format. string yy$=Text(Date(7/10/2014),D1)$; yy$=; // returns yy = Thursday, July 10, 2014