function signal = readref (filename, linestoignore) % signal = readref(filename [, linestoignore]) % Reads the ref file passed in and returns the signal; linestoignore % defaults to 10, but can be custom set. if nargin < 2, linestoignore = 10; end if nargin < 1, error('No filename given to readref().'); end if ~exist(filename, 'file'), error([filename ' is not a file.']); end try fid = fopen(filename); ignore = textscan(fid, '%s', linestoignore, 'delimiter', '\n'); [ data ] = textscan(fid,'%n'); signal = data{1}; catch e fclose(fid); rethrow(e); end fclose(fid); end