#176 Fixed 'end' indexing in MATLAB