Why does the read function occasionally freeze MATLAB?

3 ビュー (過去 30 日間)
Tom
Tom 2013 年 2 月 12 日
I'm reading in frames of a video, and for some reason, occasionally the program will just stop reading in frames and MATLAB will freeze. Is there anyway I can fix this? Thank you!
videoObject = mmreader('5A-5D_OCT_2012.wmv');
videoObject.NumberOfFrames;
sugarVideo = read(videoObject,inf);
numberOfFrames = videoObject.NumberOfFrames;
n = rand(1,numberOfFrames);
sugar = cell(1,numberOfFrames);
for r=1:numberOfFrames
n(r) = r;
end
for r = 1:numberOfFrames
sugar{r}= read(videoObject, n(r));
if r==400 || r>=460
r
end
end

回答 (1 件)

Jason Ross
Jason Ross 2013 年 2 月 12 日
編集済み: Jason Ross 2013 年 2 月 12 日
When the "freeze" happens, has your machine exhausted the amount of RAM it has and started using virtual memory (aka swap)? You can check this using Task Manager -- if the RAM amount is maxed out, you are using disk to act as memory, which is considerably slower.
Do other programs also slow to a crawl as well, or just MATLAB?
Does it ever recover?
  1 件のコメント
Tom
Tom 2013 年 2 月 12 日
It hasn't completely exhausted the RAM, but significantly higher than normal. However the program uses more while it is running than when it is frozen. Also, the CPU usage drops dramatically after it freezes.
It's just MATLAB
No, it doesn't. I have to end the process and open it again.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeAudio and Video Data についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by