Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hackassin
GitHub Repository: hackassin/Coursera-Machine-Learning
Path: blob/master/Week 9/Programming Assignment - 8/ex8/loadMovieList.m
616 views
1
function movieList = loadMovieList()
2
%GETMOVIELIST reads the fixed movie list in movie.txt and returns a
3
%cell array of the words
4
% movieList = GETMOVIELIST() reads the fixed movie list in movie.txt
5
% and returns a cell array of the words in movieList.
6
7
8
%% Read the fixed movieulary list
9
fid = fopen('movie_ids.txt');
10
11
% Store all movies in cell array movie{}
12
n = 1682; % Total number of movies
13
14
movieList = cell(n, 1);
15
for i = 1:n
16
% Read line
17
line = fgets(fid);
18
% Word Index (can ignore since it will be = i)
19
[idx, movieName] = strtok(line, ' ');
20
% Actual Word
21
movieList{i} = strtrim(movieName);
22
end
23
fclose(fid);
24
25
end
26
27