edited-making value 0

In my previous posts the answer is correct,but every time i run i get different answer,randperm is used,but i dont want to values to e b echanged wen i run different times,please help

 採用された回答

Andrei Bobrov
Andrei Bobrov 2012 年 2 月 2 日

0 投票

EDIT
A=[2 4 5
6 8 9
1 3 4 ];
A_1_10 = A(:,:,ones(10,1));
k = nchoosek(1:9,3);
k2 = k(all(diff(k,1,2)>1,2),:)
k3 = k2(1:floor(size(k2,1)/10):end,:)
A_1_10(bsxfun(@plus,k3(1:10,:),(0:9:9^2).')) = 0

2 件のコメント

kash
kash 2012 年 2 月 2 日
Abdrei getting error
Undefined variable k.
Andrei Bobrov
Andrei Bobrov 2012 年 2 月 2 日
corrected

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

その他の回答 (1 件)

Andreas Goser
Andreas Goser 2012 年 2 月 2 日

0 投票

So you want to have random number, but always the same set of random numbers? Check out RandStream.

2 件のコメント

kash
kash 2012 年 2 月 2 日
Andreas i dont need random generation,if u use random,every time i run my values get changed ,i dont want that ,dont need to use rand function
Bjorn Gustavsson
Bjorn Gustavsson 2012 年 2 月 2 日
Kash, you answer before checking RandStream. That way you happen to give a comment that make you appear "less intelligent than you'd want to". Check out the documentation of RandStream, then answer.
HTH

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

カテゴリ

ヘルプ センター および File ExchangeRandom Number Generation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by