read_elements {neuroim2} | R Documentation |
Read a sequence of elements from an input source
Description
Read a sequence of elements from an input source
Usage
read_elements(x, num_elements)
Arguments
x |
the input channel |
num_elements |
the number of elements to read |
Value
A vector
containing the elements read from x
.
Examples
# Create a temporary binary file with test data
tmp <- tempfile()
con <- file(tmp, "wb")
test_data <- rnorm(100)
writeBin(test_data, con, size = 8)
close(con)
# Create a BinaryReader and read the data
reader <- BinaryReader(tmp, byte_offset = 0L,
data_type = "double", bytes_per_element = 8L)
data <- read_elements(reader, 100)
close(reader)
# Clean up
unlink(tmp)
[Package neuroim2 version 0.8.1 Index]