Q:

Employ early bail-out in MATLAB

There is a example for Employ early bail-out in this book (http://www.amazon.com/Accelerating-MATLAB-Performance-speed-programs/dp/1482211297) (@YairAltman). for speed improvement we can convert this code:
data = [];
newData = [];
outerIdx = 1;
while outerIdx <= 20
    outerIdx = outerIdx + 1;
    for innerIdx = -100 : 100
        if innerIdx == 0
            continue % skips to next innerIdx (=1)
        elseif outerIdx > 15
            break % skips to next outerIdx
        else
            data(end+1) = outerIdx/innerIdx;
            newData(end+1) = process(data);
        end
    end % for innerIdx
end % while outerIdx

to this code:
function bailableProcessing()
for outerIdx = 1 : 5
    middleIdx = 10
    while middleIdx <= 20
        middleIdx = middleIdx + 1;
        for innerIdx = -100 : 100
            data = outerIdx/innerIdx + middleIdx;
            if data == SOME_VALUE
                return
            else
                process(data);
            end
        end % for innerIdx
    end % while middleIdx
end % for outerIdx
end % bailableProcessing()

How we did this conversion? Why we have different middleIdx range in new code? Where is checking for innerIdx and outerIdx in new code? what is this new data = outerIdx/innerIdx + middleIdx calculation?
we have only this information for second code :

We could place the code segment that should be bailed-out within a
  dedicated function and return from the function when the bail-out
  condition occurs.

A:

I am sorry that I did not clarify within the text that the second code segment is not a direct replacement of the first. If you reread the early bail-out section (3.1.3) perhaps you can see that it has two main parts: 
The first part of the section (which includes the top code segment) illustrates the basic mechanism of using break/continue in order to bail-out from a complex processing loop, in order to save processing time in computing values that are not needed.
In contrast, the second part of the section deals with cases when we wish to break out of an ancestor loop that is not the direct parent loop. I mention in the text that there are three alternatives that we can use in this case, and the second code segment that you mentioned is one of them (the other alternatives are to use dedicated flags with break/continue and to use try/catch blocks). The three code segments that I provided in this second part of the section should all be equivalent to each other, but they are NOT equivalent to the code-segment at the top of the section.
Perhaps I should have clarified this in the text, or maybe I should have used the same example throughout. I will think about this for the second edition of the book (if and when it ever appears).
I have used a variant of these code segments in other sections of the book to illustrate various other aspects of performance speedups (for example, 3.1.4 & 3.1.6) - in all these cases the code segments are NOT equivalent to each other. They are merely used to illustrate the corresponding text.
I hope you like my book in general and think that it is useful. I would be grateful if you would place a positive feedback about it on Amazon (direct link).
p.s. - @SamRoberts was correct to surmise that mention of my name would act as a "bat-signal", attracting my attention :-)

