readgenbin
Usage:
[data, time_trace] = readgenbin(filename, start_time, end_time, endian);
Parameters:
filename: Path to GENESIS file.
start_time, end_time: Time in milliseconds relative to the ACTUAL
time of the experiment at which data adquisition started
(if you start gathering data at 200 ms and you specify 0
start time it will not work). If either is [] or NaN, defaults
to beginning and end of trace, respectively. end_time is
not inclusive.
endian: (optional) Indicates file format; 'l' for little endian
and 'b' for big endian. See the "machineformat" option
in fopen for more information. Defaults to the native endian
of this computer.
Returns:
data: Data vector or matrix read.
time_trace: (Optional) Corresponding time range vector (in ms).
Description:
Files should be created by the disk_out method in the GENESIS neural
simulator. No checking for binary type is made, so if you want reliability please
ensure the file is a binary. Files written by GENESIS on big-endian
machines (like old Mac and Solaris machines with PowerPC architecture)
must be loaded with the endian='b' option. There are sanity checks to
flag that the file may be reverse-endian, but this is not automatically
corrected.
Example:
Fully read a native-endian file:
>> dat = readgenbin('mydir/myfile.bin');
Specify a time range:
>> dat = readgenbin('mydir/myfile.bin', 100, 1000);
Get a time vector back:
>> [dat, t] = readgenbin('mydir/myfile.bin', 100, 1000);
>> figure; plot(t, dat);
Force to fully load big-endian Mac file on PC platform:
>> dat = readgenbin('mydir/mymacfile.bin', NaN, NaN, 'b');
See also: fopen
Author:
Alfonso Delgado-Reyes original version based in open
binary from Simon Peron.
Cengiz Gunay <cengique _AT_ users.sf.net> for error checking, verbose
output, endian support, and other minor modifications.
Cite As
Cengiz Gunay (2024). readgenbin (https://www.mathworks.com/matlabcentral/fileexchange/36283-readgenbin), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |