How can I export a MATLAB movie in a format that can be played by users on a website in MATLAB 7.6 (R2008a)?
조회 수: 16 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2009년 6월 27일
편집: MathWorks Support Team
2024년 10월 31일
I have created a movie in MATLAB by iteratively calling "getframe". I can view the movie using the "movie" function. I would like to be able to publish my movie on a website. How can I do this? Below is the code I use to generate the movie.
Z = peaks; surf(Z);
% Record the movie with 20 frames
for j = 1:20
% Plot SURF
surf(sin(2*pi*j/20)*Z,Z)
% Get the frame
F(j) = getframe;
end
% Play the movie
movie(F)
채택된 답변
MathWorks Support Team
2024년 10월 22일
편집: MathWorks Support Team
2024년 10월 31일
The best way to export a movie from MATLAB 7.6 (R2008a) is to use the command "movie2avi". For example, after executing the code above, the following command can be issued:
movie2avi(F,'myavifile.avi','Compression','Cinepak')
The following HTML code can then be used to allow the movie to be viewed on a web page:
<embed align="center" src="myavifile.avi" width="640" height="480" autoplay="true" controller="true" cache="true" type="video/x-msvideo" />
Or a link can be created so that the user can download the AVI file:
<a href="myavifile.avi">Here is a movie to download</a>
Note that for this example to work, the HTML file and the generated AVI file must be in the same directory.
댓글 수: 3
Walter Roberson
2020년 10월 19일
The question very specifically asks about
MATLAB 7.6 (R2008a)
So what is required in current MATLAB versions is only relevant as a side note.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 MATLAB Report Generator에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!