Terminate block of code, or indicate last array index
parfor statements. Without an
parfor wait for further input. Each
paired with the closest previous unpaired
parfor and serves to delimit its scope.
end also marks the termination of a function.
Although it is sometimes optional, use
better code readability. If your function contains one or more nested
functions, then you must terminate every function in the file, whether
nested or not, with
end. This includes primary,
nested, private, and local functions.
If your script contains local functions, then you must terminate
every local function in the file with
end function also serves as the last
index in an indexing expression. In that context,
the same as
size(X,k) when used as part of the
index into array
X. Examples of this use are
select the third through final elements of the array, and
select all even elements of the first row, excluding the last element.
end to grow an array, as in
X exists first.
This example shows
end used with the
for k = 1:n if a(k) == 0 a(k) = a(k) + 2; end end
In this example,
end is used in an indexing
A = magic(5) A = 17 24 1 8 15 23 5 7 14 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9 B = A(end,2:end) B = 18 25 2 9