The variable FileInfo.nChannles
is defined in the function read_settings.m like this:
FileInfo.nChannels = double(TotChans);
Where TotChans
is defined like:
TotChans = NumChans + NumCChan + NumLRChans
I’m not using Calcultated Channels either Load Roses Channels so their value is zero.
After running the code step by step, I found a piece of code I don’t understand. In this part of the code, the value of NumChans
if calculated.
HeadLines = textscan( fidData, '%s', NamesLine, 'delimiter', '\n' );
fclose( fidData );
temp = textscan( HeadLines{1}{NamesLine}, '%s' );
NumChans = size( temp{1}, 1 );
% NumChansSN = NumChans;
ChanNames = cell( 1, NumChans );
for Ch=1:NumChans
% ChanNames{Ch} = [ '$', temp{1}{Ch} ];
ChanNames{Ch} = temp{1}{Ch};
end % for Ch
According to the MATLAB webpage definition, the textscan
function can be used to “read formatted data from text file or string”. Why is it used here if the data file can also be binary?
To try to understand this piece of code I used an ASCII output file, since MLife works well with this type of formats. Basicly it reads the header of the output file and saves it in a cell array. Then, move all the names of the channels to temp
and uses its size to calculate the number of channels.
When I repeated this process with a binary output file I saw that, maybe because of textscan
, the cell array was full of strange symbols (like this: ¦Yù…ì7þÙ ÄV ±·»¤/ ·$"DÑO2=,¡ Ä+1 úz) and I think they are been treated like normal text. That’s why it just reads 4.