I was trying to figure out what the following Octave code does:
degree = 6;
out = ones(size(X1(:,1)));
for i = 1:degree
for j = 0:i
out(:, end+1) = (X1.^(i-j)).*(X2.^j);
end
end
I wasn't sure what the end+1 meant in Octave until I found the answer for Matlab here: What is the `end+1` line doing here? The accepted answer links to the Matlab official documentation which is very clear: https://www.mathworks.com/help/matlab/ref/end.html
I'm trying to find the documentation for this same keyword in the Octave documentation but I can't seem to find it. I've searched in the Documentation tab (Octave 5.1.0), using the function index and the search tab to no avail although I see it used in several documentation pages.
The Octave documentation, which seems to be categorized more by usage than keyword, on Index Expressions is also as explicit:
In index expressions the keyword
endautomatically refers to the last entry for a particular dimension. This magic index can also be used in ranges and typically eliminates the needs to call size or length to gather array bounds before indexing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With