/
writeVec
writeVec
Description
Use to write one or more vectors to a file. Command will accept any number of vector arguments, including arrays.
The following list shows the different cast types. Note that data can be lost when casting. 'Signed' means the value can be negative. 'Unsigned' means value is always positive.
Cast | Description |
---|---|
"c" | Writes each vector channel value as a signed character, or a signed 8 bit (1 byte) value" |
uc" | Writes each vector channel value as an unsigned character, or an unsigned 8 bit (1 byte) value |
"s" | Writes each vector channel value as a signed short integer, or a signed 16 bit (2 bytes) value |
"us" | Writes each vector channel value as an unsigned short integer, or an unsigned 16 bit (2 bytes) value |
"i" | Writes each vector channel value as a signed integer, or a signed 32 bit (4 bytes) value |
"ui" | Writes each vector channel value as an unsigned integer, or an unsigned 32 bit (4 bytes) value |
"f" | Writes each vector channel value as a floating point value, a 32 bit (4 byte) value |
Functional area
Disk I/O
Command syntax
Syntax
writeVec "fileID" vecValue1 vecValue2...[-delim string] [-cast string] |
Arguments
Name | Type | Required | Comments |
---|---|---|---|
fileID | int | ID of file previously opened with fileOpen | |
vector1 | vector or vector array | One or more values to be written to the file | |
vector2 | optional vector or vector array | Command can accept any number of vectors/arrays to write to the file |
Flags
Name | Flag arguments | Argument type | Exclusive to | Comments |
---|---|---|---|---|
delim | 1 | string | — | Delimiter to use between vector channel values. Cannot be used with binary files. Usually "," or "\t", etc. |
cast | 1 | string | — | Data type to cast to. Possible types are listed above. Note that data can be lost when casting. |
Return value
void
Examples
vector $vec = << 100.0, 500.7, -50.5 >>; int $fileID; // Open the file and get the ID // ... // Write the vector // The -delims flag assumes you are writing to a text file writeVec $fileID $vec -delims ",";
Additional information
Related commands
, multiple selections available,
Related content
readVec
readVec
More like this
writeRot
writeRot
More like this
writeInt
writeInt
More like this
writeString
writeString
More like this
writeFloat
writeFloat
More like this
writeBool
writeBool
More like this