How to remove extra numbers to reduce size of vector?

2 visualizaciones (últimos 30 días)
Ammy
Ammy el 11 de Mzo. de 2022
Comentada: Ammy el 11 de Mzo. de 2022
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);

Respuesta aceptada

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

Más respuestas (0)

Categorías

Más información sobre Multidimensional Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by