Create new array with repeated values (error k must be less than or equal to N)

조회 수: 3 (최근 30일)
Ali Tawfik
Ali Tawfik 2020년 8월 28일
댓글: Rik 2020년 8월 28일
Trying to create a new array with repeated values .. I tried randperm but can not , as k must be less than or equal to N
clearvars;
clc
org_thick=[.125 .15 .25 .5 1];
new_thick=org_thick(randperm(numel(org_thick),8));

답변 (1개)

Bruno Luong
Bruno Luong 2020년 8월 28일
편집: Bruno Luong 2020년 8월 28일
new_thick = org_thick(randi(end,1,8))

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by