You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
396 B
Matlab
19 lines
396 B
Matlab
10 years ago
|
function file_contents = readFile(filename)
|
||
|
%READFILE reads a file and returns its entire contents
|
||
|
% file_contents = READFILE(filename) reads a file and returns its entire
|
||
|
% contents in file_contents
|
||
|
%
|
||
|
|
||
|
% Load File
|
||
|
fid = fopen(filename);
|
||
|
if fid
|
||
|
file_contents = fscanf(fid, '%c', inf);
|
||
|
fclose(fid);
|
||
|
else
|
||
|
file_contents = '';
|
||
|
fprintf('Unable to open %s\n', filename);
|
||
|
end
|
||
|
|
||
|
end
|
||
|
|