loadMovieList.m 651 B

12345678910111213141516171819202122232425
  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. %% Read the fixed movieulary list
  7. fid = fopen('movie_ids.txt');
  8. % Store all movies in cell array movie{}
  9. n = 1682; % Total number of movies
  10. movieList = cell(n, 1);
  11. for i = 1:n
  12. % Read line
  13. line = fgets(fid);
  14. % Word Index (can ignore since it will be = i)
  15. [idx, movieName] = strtok(line, ' ');
  16. % Actual Word
  17. movieList{i} = strtrim(movieName);
  18. end
  19. fclose(fid);
  20. end