sampling like this expression

7 ビュー (過去 30 日間)
eren eren
eren eren 2013 年 3 月 8 日
i generate a sample for example it's size is 30. And i find its minimum.
for example sample is
A=[1 5 8 9 7 6 4 5] min(A)=1
and i want to delete 1 from A. new A is A=[5 8 9 7 6 4 5]
then i want to sampling 2 element for example b=[9 4]
and i want to delete this numbers from A. new A is A=[5 8 7 6 5]
then this continue when A has no elements.
how can i do this?
sayi= exprnd(100,1,30); enkucuk=min(sayi)
i dont do anything after these steps. Thank you

回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 3 月 8 日
A=[1 5 8 9 7 6 4 5]
[val,idx]=min(A)
A(idx)=[]
b=[9 4]
A(ismember(A,b))=[]
  4 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 3 月 8 日
編集済み: Azzi Abdelmalek 2013 年 3 月 8 日
A=[1 5 8 9 7 6 4 5]
b=nchoosek(A,2)
b=b(randi(size(b,1)),:)
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 3 月 8 日
編集済み: Azzi Abdelmalek 2013 年 3 月 8 日
%or
A=[1 5 8 9 7 6 4 5]
k=2
idx=randperm(numel(A));
b=A(idx(1:k))

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

カテゴリ

Help Center および File ExchangeCorrelation and Convolution についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by