How to make elements in an array permanant
4 ビュー (過去 30 日間)
古いコメントを表示
I'm creating function that has a random array using randperm. Is there a way to fix the order of the elements in the array even when I run it several times? Every time I use the function, a new array will be produced. I want the function to be so that the randperm will only run once no matter how many times I click 'run'. Thanks
0 件のコメント
採用された回答
Azzi Abdelmalek
2013 年 3 月 27 日
You can save your array in a mat file
1 件のコメント
Azzi Abdelmalek
2013 年 3 月 27 日
編集済み: Azzi Abdelmalek
2013 年 3 月 27 日
Or
stream = RandStream('twister','Seed',0); % 'twister' is a generator
randperm(stream,5)
その他の回答 (1 件)
James Tursa
2013 年 3 月 27 日
You could fix the seed used every time so you get the same stream of random numbers with each trial. See the rng function:
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!