Picking random values from an array.

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.

回答 (1 件)

Rik
Rik 2022 年 12 月 5 日

0 投票

k=round(numel(Data)/100);
Data(sort(randperm(end,k))
This will give you a random sample of your vector.

2 件のコメント

Donne
Donne 2022 年 12 月 5 日
Thank you. it works
Rik
Rik 2022 年 12 月 5 日
You're welcome.
If this solved the problem, please consider marking it as accepted answer.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

質問済み:

2022 年 12 月 5 日

コメント済み:

Rik
2022 年 12 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by