Menu

DataTypes

LabRAD Data Types

Overview

LabRAD data is stored together with a Type Tag describing its format. LabRAD supports several different Basic Data Types that can be combined into Composite Types and annotated by Type Modifiers.

For a formal description, refer to the EBNF LabRAD Grammar.

Basics Types

Tag Name Description Example Data
b Boolean Flag True
i Integer Signed whole number -1,500,000,000
w Word Unsigned whole number 3,750,000,000
s String Text "Hello World"
v Value Real number -1.637e23
c Complex Complex number 3.2 + 1.6i
t TimeStamp Time and date 1/15/2006 12:53pm
? Any Placeholder for any type N/A
_ Empty Unspecified array type N/A

Composite Types

Tag Name Description Example Type Tag and Data
*? or *n? Array List of data with n dimensions *s: "Karl", "Peter", "Tom"
(...) Cluster Collection of data (sw): "Karl", 27
E or E? Error Error message E: 15: "Can't divide by 0!"

Type Modifiers

Tag Name Description Example Type Tag
[...] Units Units of a Value or Complex v[GHz]
{...} Comment Type tag annotation s{Name}
:... End Marks the end of the type tag b: Turn instrument on(T)/off(F)

Examples of Valid Type Tags

Type Tag Example Data
s "Hello World"
b {Trigger} False
v[m/s^2]: Acceleration 6.2
c[ ]: Units of 1 2.8 - 6.3i
v: No units given -12.3e7
(t, v[mV]) {timestamped data} (5/17/2002 3:02:18pm, 150.1)
*(s{name}, w{age}): members ("Karl", 27), ("Peter", 25)
*3w {3D array of numbers} [[[1,2,3],[4,5,6]],[[7,8,9],[10,11,12]]]
*2_ {2D empty array of unknown type} [[ ]]
*2w {2D empty array of known type} [[ ]]
E 12, "Device unknown"
Es 10, "Port in use", "COM3"

Examples of Invalid Type Tags

Type Tag Description
g Unknown tag
(ws Missing )
w{age Missing }
s{no "}" here} First } ends comment, following " is not a known tag
w[GHz] Only v and c can have units
v[2] See Units section for valid unit string
w{frq}[GHz] Units must follow type tag immediately; use w[GHz]{frq}
_ Only for arrays; empty data has an empty type tag
( ) or (_) Clusters cannot be empty
* No array type specified; use *_ instead
**w Use *2w for rectangular or *(*w) for jagged instead
*w5 Dimensionality must immediately follow *
*{test}5w Dimensionality must immediately follow *
*:w : marks the end of the tag
sE E or E? must be the only tag
Esw Only E(sw) is allowed

 

~ Markus Ansmann, Dec 12th, 2007


Related

Wiki: Grammar
Wiki: Protocol
Wiki: QuickStartExplorer
Wiki: Units

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.