sampling like this expression

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일

0 개 추천

A=[1 5 8 9 7 6 4 5]
[val,idx]=min(A)
A(idx)=[]
b=[9 4]
A(ismember(A,b))=[]

댓글 수: 4

eren eren
eren eren 2013년 3월 8일
편집: eren eren 2013년 3월 8일
thank you but b is a random sample. how can i sapmling it? for example n=10 k=2. i want to choose a combination(n,k) ?
nchoosek(n,k) is providing all possible combinations, but i want just one
Azzi Abdelmalek
Azzi Abdelmalek 2013년 3월 8일
What are n and k?
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))

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

카테고리

도움말 센터File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

제품

질문:

2013년 3월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by