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

产生一组样本数据,我想去掉其中任意几个样本,例如: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'怎么去掉谢谢!

 Accepted Answer

simeseg
simeseg on 18 Nov 2022

0 votes

版本太老,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)=[]

More Answers (0)

Categories

Find more on 启动和关闭 in Help Center and File Exchange

Tags

Asked:

on 18 Nov 2022

Answered:

on 18 Nov 2022

Community Treasure Hunt

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

Start Hunting!