function x = loadsig(filename,N,offset) % loadsig --> Load signal from mat-file. % % % x = loadsig(filename,N) % x = loadsig(filename,N,offset) % % % Load the file filename.mat from disk, and generate an N-sample % vector x from the variable name filename with an specified offset. % Finally, the resulting sequence x is peak-normalized. % % Peter S.K. Hansen, IMM, Technical University of Denmark % % Last revised: February 7, 2000 %----------------------------------------------------------------------- % Check the required input arguments. if (nargin < 2) error('Not enough input arguments.') elseif (nargin == 2) offset = 0; end % Load the file and find the variable. eval(['load ',filename]); x = eval(filename); % Make sure that the signal is a column vector. x = x(:); % Get N samples, starting from the offset point. x = x(offset+1:offset+N); % Peak-normalize. x = x/max(abs(x)); %----------------------------------------------------------------------- % End of function loadsig %-----------------------------------------------------------------------