I wrote
array = linspa开发者_运维知识库ce(0, 1);
sliceSize = 10;
sliceBegin = 1 + length(array) - sliceSize;
slice = array(sliceBegin: length(array));
that's too verbose. How to make it shorter?
a = rand(100,1); %# vector
a(end-5+1:end) %# last five elements
精彩评论