Moving course1 to course1 subdir.
This commit is contained in:
18
machine_learning/course1/mlclass-ex6-008/mlclass-ex6/readFile.m
Executable file
18
machine_learning/course1/mlclass-ex6-008/mlclass-ex6/readFile.m
Executable file
@@ -0,0 +1,18 @@
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user