LabKit MATLAB Workbench

reference

API ReferenceIntan RHS Recordings

labkit.rhs.indexFile

Build a block index for reading selected RHS time windows.

Syntax

[index, status] = labkit.rhs.indexFile(filepath)

Description

Inspects the file header and records the byte and sample layout used by readWindow. No waveform arrays are loaded. Header-only files produce a valid index with hasData=false. When trailing partial bytes are present, complete blocks remain usable and status.message describes the condition.

Inputs

filepath
Character vector or string scalar naming one RHS file.

Outputs

index
Scalar structure containing header information and block layout. On inspection failure, hasData is false and numeric layout fields use empty defaults.
status
Scalar structure with ok, message, and filepath. The index can be usable when ok is true and message reports trailing partial bytes.

Output Fields

info
Full structure returned by inspectFile.
sampleRateHz
Sample rate in hertz.
samplesPerBlock
Number of samples in each complete block; currently 128.
dataOffsetBytes
Byte offset of the first waveform block.
bytesPerBlock
Calculated bytes in one complete block.
dataBytes
Number of bytes following the header.
blockCount
Number of complete waveform blocks.
sampleCount
Number of samples in complete blocks.
durationSec
Complete-block duration in seconds.
exactBlocks
True when no trailing partial bytes remain.
hasData
True when at least one complete sample is available.

Errors

Throws labkit:rhs:InvalidFilepath for an invalid filepath argument. File and header failures are returned in status.

Example

[index, status] = labkit.rhs.indexFile("recording.rhs");
if status.ok && index.hasData
fprintf("%d samples in %d blocks\n", ...
index.sampleCount, index.blockCount)
end

Source

This page is generated from the MATLAB help text in +labkit/+rhs/indexFile.m.