Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h3>EDIT:</h3> <p>After seeing your edit, a simple solution not involving the use of any toolboxes is the following: </p> <p>Since <code>MAT_2</code> is much slower than <code>MAT_1</code>, start <code>MAT_2</code> with a delay. i.e., start it when <code>MAT_1</code> has finished processing say 5 images or so. If you do this, <code>MAT_2</code> will never catch up with <code>MAT_1</code> and hence will never be in a situation where it has to "wait" for images from <code>MAT_1</code>.</p> <hr> <p>I'm still not clear on a few things from your question:</p> <ol> <li>You say <code>MAT_1</code> processes images sequentially, but <em>does it have to</em>? In other words, does the order in which they are processed matter?</li> <li>You say <code>MAT_2</code> reads the output from <code>MAT_1</code>... Does it have to be in the order that <code>MAT_1</code> finishes or can that be any order?</li> <li>You say <code>MAT_2</code> reads the image using <code>imread</code> and outputs it some where else. Is there any reason that task cannot be combined into <code>MAT_1</code>? </li> </ol> <p>In any case, you can implement some form of execution blocking using the parallel computing toolbox; but instead of using <code>parfor</code> loops (which is what most people use), you'll have to create a distributed job (<a href="http://www.mathworks.com/help/toolbox/distcomp/bq5ntwk.html" rel="nofollow">example</a>).</p> <p>The important thing to note is that each worker (lab) has a <a href="http://www.mathworks.com/help/toolbox/distcomp/labindex.html" rel="nofollow"><code>labindex</code></a>, and you can use <a href="http://www.mathworks.com/help/toolbox/distcomp/labsend.html" rel="nofollow"><code>labSend</code></a> to send data from worker 1 (equivalent of <code>MAT_1</code>) to worker 2 (equivalent of <code>MAT_2</code>), who then receives it using <a href="http://www.mathworks.com/help/toolbox/distcomp/labreceive.html" rel="nofollow"><code>labReceive</code></a>. From the documentation on <code>labReceive</code>:</p> <blockquote> <p>This function blocks execution in the lab until the corresponding call to labSend occurs in the sending lab.</p> </blockquote> <p>which is pretty much what you wanted to do with <code>MAT_1</code> and <code>MAT_2</code>.</p> <p>Another way to do this would be to spawn one additional worker in your current session, but only assign tasks performed by <code>MAT_1</code> to it. You then set the <a href="http://www.mathworks.com.au/help/toolbox/distcomp/finishedfcn.html" rel="nofollow"><code>FinishedFcn</code></a> property for the tasks to execute the set of functions performed by <code>MAT_2</code>, but I wouldn't recommend it as I don't think this was the intent for <code>FinishedFcn</code>, and I don't know if it will break in certain cases. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload