function out=fileread(filename)
%FILEREAD Return contents of file as string vector.
%
% See also FREAD, TEXTREAD, LOAD, WEB

% Copyright 1984-2000 The MathWorks, Inc.
% $Revision: 1.3 $  $Date: 2000/06/01 04:18:06 $

% Validate input args
if nargin==0, error('Not enough input arguments.'); end

% get filename
if ~isstr(filename), error('Filename must be a string.'); end

% do some validation
if isempty(filename), error('Filename must not be empty.'); end

% make sure file exists
if ~isequal(exist(filename), 2), error('File not found.'), end

% open the file
fid = fopen(filename);
if fid == (-1)
    error(['Could not open file ', filename ,'.']);
end

out=char(fread(fid)');
fclose(fid);
