필터 지우기
필터 지우기

Take percentage of a data set

조회 수: 3 (최근 30일)
jgillis16
jgillis16 2015년 7월 28일
댓글: jgillis16 2015년 7월 29일
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!
  댓글 수: 1
Azzi Abdelmalek
Azzi Abdelmalek 2015년 7월 28일
If a=4; what is 17.65% of a?

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2015년 7월 29일
num_to_fetch = round(17.65 / 100 * length(YourVector));
your_subset = YourVector(randperm(length(YourVector), num_to_fetch));

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by