How to remove extra numbers to reduce size of vector?

1 次查看(过去 30 天)
The following code removes extra number from the start of vector A if the size is not divisible by 3,
I want to remove extra numbers from the end of vector A.
A = rand(10000,1);
s = 3;
shortvector = A((end-s*floor(end/s)+1):end);

采纳的回答

KSSV
KSSV 2022-3-11
A = rand(10000,1);
s = 3;
n = mod(length(A),s) ;
iwant = A(1:end-n) ;

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by