去掉向量的任意几个分量的命令函数是什么。

产生一组样本数据,我想去掉其中任意几个样本,例如:x=(0.2,0.3,0.5,0.5,0.6,0.6,0.7,0.7,0.7,0.8,0.8,1.0,1.0,1.0,1.1,1.3
1.5,1.5,2.0,2.0,2.2,2.7,3.0,3.0,3.3,4.0,4.0,4.5);去掉样本X中第五个到第30个样本中任意5个样本,请问用matlab'怎么去掉谢谢!

 Risposta accettata

simeseg
simeseg il 18 Nov 2022

0 voti

版本太老,randperm不支持两个参数:
x=[0.2,0.3,0.5,0.5,0.6,0.6,0.7,0.7,0.7,0.8,0.8,1.0,1.0,1.0,1.1,1.3,1.5,1.5,2.0,2.0,2.2,2.7,3.0,3.0,3.3,4.0,4.0,4.5,1.3,2.2]
% k=randperm(26,5)+4
k=randperm(26);
k=k(1:5)+4;
x(k)=[]

Più risposte (0)

Categorie

Scopri di più su 启动和关闭 in Centro assistenza e File Exchange

Tag

Richiesto:

il 18 Nov 2022

Risposto:

il 18 Nov 2022

Community Treasure Hunt

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

Start Hunting!