Cursera: machine learning ex8.
This commit is contained in:
25
machine_learning/mlclass-ex8-008/mlclass-ex8/loadMovieList.m
Executable file
25
machine_learning/mlclass-ex8-008/mlclass-ex8/loadMovieList.m
Executable file
@@ -0,0 +1,25 @@
|
||||
function movieList = loadMovieList()
|
||||
%GETMOVIELIST reads the fixed movie list in movie.txt and returns a
|
||||
%cell array of the words
|
||||
% movieList = GETMOVIELIST() reads the fixed movie list in movie.txt
|
||||
% and returns a cell array of the words in movieList.
|
||||
|
||||
|
||||
%% Read the fixed movieulary list
|
||||
fid = fopen('movie_ids.txt');
|
||||
|
||||
% Store all movies in cell array movie{}
|
||||
n = 1682; % Total number of movies
|
||||
|
||||
movieList = cell(n, 1);
|
||||
for i = 1:n
|
||||
% Read line
|
||||
line = fgets(fid);
|
||||
% Word Index (can ignore since it will be = i)
|
||||
[idx, movieName] = strtok(line, ' ');
|
||||
% Actual Word
|
||||
movieList{i} = strtrim(movieName);
|
||||
end
|
||||
fclose(fid);
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user