I want to play a avi file in matlab environment, supported by a graph underneath it, which also changes according to specific time in the movie. Any suggestions?

 Accepted Answer

See http://www.mathworks.com/matlabcentral/answers/216698-how-to-play-my-video-while-my-graph-animates which is similar to your question. The proposed solution is to display the frames from the movie in a loop. You can modify that so that at certain periods of this loop, you would update the graph.

3 Comments

Hi Geoff, thanks for your answer. I found that question and chose to do it in the following way:
workingDir1='C:......;
workingDir2='C.......;
imageNames = dir(fullfile(workingDir,'Output','*.jpg'));
imageNames = {imageNames.name}';
imageStrings = regexp([imageNames{:}],'(\d*)','match');
imageNumbers = str2double(imageStrings);
% Sort the frame numbers from lowest to highest. The sort function returns an index matrix that indicates how to order the associated files.
[~,sortedIndices] = sort(imageNumbers);
sortedImageNames = imageNames(sortedIndices);
for k= 1:length(sortedImageNames);
X1=imread(fullfile(workingDir,'Output',sortedImageNames{k}));
X2=imread(fullfile(workingDir,'Output',sortedImageNames{k}));
figure(1);
subplot_tight(2,4,[1 2 3 4]);
imshow(X1)
subplot_tight(2,4,[5 6 7 8]);
imshow(X2)
drawnow
end
Is this also a good way or would your way get me better results? Especially the visibility and relative size of the plot/video is a thing I would like to adjust.
And the speed of the images is very low, do you know how to speed things up?
S - please clarify what you mean that the speed of the images is very low. Do you want to speed it up? It looks like X1 and X2 are identical in the above code. Is this intentional?

Sign in to comment.

More Answers (0)

Categories

Find more on Images in Help Center and File Exchange

Asked:

on 8 Sep 2015

Commented:

on 10 Sep 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!