Borrar filtros
Borrar filtros

Take percentage of a data set

3 visualizaciones (últimos 30 días)
jgillis16
jgillis16 el 28 de Jul. de 2015
Comentada: jgillis16 el 29 de Jul. de 2015
I need to take 17.65% of a 2016x1 double array (meaning I only want 17.65% of the data in that array).
What would the code for this look like?
Thanks!

Respuesta aceptada

Walter Roberson
Walter Roberson el 29 de Jul. de 2015
num_to_fetch = round(17.65 / 100 * length(YourVector));
your_subset = YourVector(randperm(length(YourVector), num_to_fetch));

Más respuestas (0)

Categorías

Más información sobre Data Types en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by