Picking random values from an array.

6 visualizaciones (últimos 30 días)
Donne
Donne el 5 de Dic. de 2022
Comentada: Rik el 5 de Dic. de 2022
I extracted some data for a work using MATLAB and plot these values, but because the number of values in the array were many, my model had lots of noise in it. So i would to know how I could select just a few points which are spread along the plot from the start through to the end.

Respuestas (1)

Rik
Rik el 5 de Dic. de 2022
k=round(numel(Data)/100);
Data(sort(randperm(end,k))
This will give you a random sample of your vector.
  2 comentarios
Donne
Donne el 5 de Dic. de 2022
Thank you. it works
Rik
Rik el 5 de Dic. de 2022
You're welcome.
If this solved the problem, please consider marking it as accepted answer.

Iniciar sesión para comentar.

Categorías

Más información sobre Creating and Concatenating Matrices 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