Read text.m

From Pnb
Jump to navigation Jump to search
% Title:        READ_TEXT.M
% Date:         7/99
% Author:       SRW
% Input:        filename
% Output:       padded string array
% Files:        auxillary files
% Assumes:      file formats, etc.
% Purpose:      reads a text file and returns padded string array
% Calls:        
% Uses:         who calls me?
% Example:      A=read_text(FILENAME)
% NOTES:        

function [A]=read_text(filename)
A=[];
filename;
fid=fopen(filename,'r');
if fid==-1,
  return
end
while fid,
  nline=fgetl(fid);
  if nline==-1, break, end
  A=strvcat(A,nline);
end
fclose(fid);
return

read_text