标签: arrays matlab
我写了
array = linspace(0, 1); sliceSize = 10; sliceBegin = 1 + length(array) - sliceSize; slice = array(sliceBegin: length(array));
太冗长了。如何缩短它?
答案 0 :(得分:19)
a = rand(100,1); %# vector a(end-5+1:end) %# last five elements