Read text.m

From Pnb
Revision as of 15:54, 5 August 2010 by 128.111.101.185 (talk) (Created page with '<pre> % Title: READ_TEXT.M % Date: 7/99 % Author: SRW % Input: filename % Output: padded string array % Files: auxillary files % Assumes:…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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