How can I run 2 tasks in parallel?
이전 댓글 표시
I have 2 scripts.
Script1.m___________%infinite while loop which constantly modifying a 'fixed length array'
Script2.m___________% again infinite loop which is processing a live video.
Script1 is independent. But script2 requires the fixed length array generated by script1 before starting image processing on each frame.
I can't merge the scripts because time taken by image processing is significant and will modify script1's independency.
Any alternate non-conventional ideas are also welcome.
Thanks
댓글 수: 3
Walter Roberson
2018년 7월 2일
There are no options that will not involve modifying the script. There is no way to share information between workers without modifying code.
Exception: if they really are scripts, then you could wrap them in functions that take care of the memory sharing details, possibly without modifying the scripts themselves.
JAI PRAKASH
2018년 7월 2일
편집: JAI PRAKASH
2018년 7월 2일
Walter Roberson
2018년 7월 2일
You should consider using a circular buffer; they are faster than what you are doing now, which involves a lot of memory re-allocations.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!