Skip to main content
. Author manuscript; available in PMC: 2023 Apr 1.
Published in final edited form as: J Clin Monit Comput. 2021 Mar 19;36(2):483–492. doi: 10.1007/s10877-021-00676-2

Table 3:

Example source code (compatible with both Matlab and Octave) to extract processed variables and scaled EEG data from a dataset stored on a USB device by a BIS Vista monitor, and also to apply the correct microvolt scaling to the EEG data.

Example Retrieval of EEG Data and Variables from the
Vista USB
Commentary

function [t,BIS,EMG,SEF,POW,EEG,EEGuV] =
readStudyFromUSB(studyID)

fid = fopen(fullfile(studyID,sprintf('%s.spa',studyID)),'rt');
c =
textscan(fid,repmat('%s',1,54),'Delimiter','∣','Headerlines',2);
fclose(fid);

t = c{1};
SEF = cellfun(@(x)str2double(x),c{37}); SEF(SEF<0) = NaN;
BIS = [cellfun(@(x)str2double(x),c{12}) …
       cellfun(@(x)str2double(x),c{26}) …
       cellfun(@(x)str2double(x),c{40})]; BIS(BIS<0) = NaN;
POW = cellfun(@(x)str2double(x),c{43}); POW(POW<0) = NaN;
EMG = cellfun(@(x)str2double(x),c{44}); EMG(EMG<0) = NaN;

fid = fopen(fullfile(studyID,sprintf('%s.r2a',studyID)),'rb');
EEG = fread(fid,[2 inf],'int16');
fclose(fid);

EEGuV = EEG * 1675.42688 / 32767;
Unlike the BIS A-2000, whose only output is a low bandwidth RS232 serial port, the BIS Vista has a rear-facing USB port that can be used to store study data on common USB flash drives. The stored studies have a standard file structure format.
The SPA file contains a large plaintext tabulation of the processed variables produced by the monitor. This is similar to, but more complete, than the similar tabulation presented over the A-2000 serial port. These values can be read and extracted by simple, appropriate text parsing of the SPA file.

Additionally, EEG data is stored in a scaled format as signed 16-bit integers (−32768 to +32767) in the R2A file. The data is channel-interleaved.

The scaled EEG data can be converted into microvolts by multiplying by a 0.0511 uV/step scale factor.