| sig2bin | R Documentation |
Saves the given data (signals) in binary form.
Input signal(s) must be a data frame: rows = samples for all channels, columns = channels.
The function is used internally in the empi.execute() function. The binary data are
floating-point values in the byte order of the current machine (no byte-order conversion is performed).
For multichannel signals, first come the samples for all channels at t=0, then for all
channels at t=\Deltat and so forth. In other words,
the signal should be written in column-major order (rows = channels, columns = samples).
sig2bin(data, write.to.file = FALSE)
data |
Data frame with the input signal(s). |
write.to.file |
If |
Input signal returned as the raw. If write.to.file=TRUE, the .bin file
will additionally be created and saved in the current directory.
The user does not work directly with .bin files. Binary files are used only in the
empi.execute() function. The external program (Enhanced Matching Pursuit Implementation,
or EMPI for short) executed inside this function requires binary data as input.
Moreover, the ability to convert text files to binary form may be useful if someone wants to work
with EMPI independently of the R environment.
file <- system.file("extdata", "sample3.csv", package = "MatchingPursuit")
out <- read.csv.signals(file)
signal.bin <- sig2bin(data = out$signal, write.to.file = FALSE)
# We have 3 channels. The first 4 time points.
head(out$signal, 4)
# The same elements of the signal in binary (floats are stored in 4 bytes).
head(signal.bin, 48)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.