How to simultaneously run two loops?

6 次查看(过去 30 天)
Ashwin
Ashwin 2014-12-24
评论: Ashwin 2014-12-25
Hi,
I am trying to perform two image processing tasks simultaneously: 1. Get data from webcam and use it to record a video. 2. Get intermittent snapshots from the same webcam, do some data processing on the images
I basically want the video recording function to go independently with the data processing. The data processing takes some time to perform. So when I try to capture video using snapshots, I get the timing of video wrong if I am doing both in the same loop.
I have an 8 core processor. Is it possible to multithread the program in some way, so that I could run the processes independently?
Please help. Thanks in advance,
Ashwin

回答(1 个)

Guillaume
Guillaume 2014-12-24
Core matlab is single threaded without any option for multithreading.
It may be possible to do what you want with the parallel computing toolbox. I don't have this toolbox so can't help you with it.
Other options is to defer the processing to a later time, reduce the time the processing takes (the parallel computing toolbox can help with this as well), or use another language to manage the jobs. On windows, .Net has excellent support for multithreading and you can call matlab function from it.
  1 个评论
Ashwin
Ashwin 2014-12-25
Thank you for the reply! I do not have the parallel computing toolbox either. I can't defer the processing for a later time because the processing is used for actuation of a device, which I am recording! Anyways, I will try out using other language as you suggested. Meanwhile, any other suggestions are always welcome!
Thank you, Ashwin

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by