Save pre-loaded videos
1 view (last 30 days)
Show older comments
I have used LoadMovieIntoTexturesDemo.m to pre-load a video. Can anyone give advice on how to save that preloaded video for later use? I would ultimately like to pre-load a number of videos and then play them later. This is the type of code, but this doesn't work:
for i=1:10
stimFname=imageNames{i};
moviename=stimFname;
LoadMovieIntoTexturesDemo(moviename);
movie_All{i}=movie;
end;
0 Comments
Answers (1)
Sugandhi
on 7 Jun 2023
Hi Jessica,
I understand that you want to save preloaded videos for later use.
The possible workaround could be:
% Create a cell array to store the loaded movies
movie_All = cell(1, 10);
for i = 1:10
stimFname = imageNames{i};
moviename = stimFname;
movie = LoadMovieIntoTexturesDemo(moviename);
movie_All{i} = movie;
end
% Save the preloaded movies to a MAT file
save('preloaded_movies.mat', 'movie_All');
In this code, a cell array `movie_All` is created to store the loaded movies. Within the loop, assuming that `LoadMovieIntoTexturesDemo(moviename)` is called to load the video, and the result is assigned to the `movie` variable. Then, the `movie` is stored in the corresponding cell of `movie_All`. After the loop, the `movie_All` is saved to a MAT file called 'preloaded_movies.mat' using the `save` function.
Later, when you want to use the preloaded videos, Load the MAT file and access the videos as shown below:
% Load the MAT file
load('preloaded_movies.mat');
% Access and use the preloaded movies
for i = 1:10
movie = movie_All{i};
% Play the movie or perform any other operations
end
By loading the 'preloaded_movies.mat' file, you can access the preloaded videos stored in the `movie_All` variable and use them as needed.
For more details, kindly go through following links:
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!