Read strip.m

From Pnb
Jump to navigation Jump to search
function [matrix,head]=read_strip(file)
% function [matrix,head]=read_strip(file)
% 
%  read a bbopstrip file

% open file
%cd(pb);
pwdinreadstrip = pwd
%cd('processing')
%file
fid=fopen(file,'r')
if (fid==-1), 
  matrix=[];
  head=[];
  return
end

% read first line to initialize loop
fgets(fid); length_header=0;

% loop to count header lines
while (ans(1:1)=='*' | ans(1:1)=='#' | ans(1:1)=='/' | ans(1:1)=='%' | ans(1:1)=='!'| ans(1:1)==' ' & ans~=-1)
	fgets(fid);
	length_header=length_header+1;
end

% done with file
fclose(fid);

% if you want to remove the # character and enumerate channels
%         head=head(:,2:size(head,2)); % remove # character
%         head=[reshape(sprintf('%3d   ',0:size(head,1)-1),6,size(head,1))', head];

% call file_read
%cd ..

[matrix,head]=file_read(file,length_header);


read_strip