フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

could anyone help me how to solve the issue.

1 回表示 (過去 30 日間)
jaah navi
jaah navi 2019 年 4 月 23 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
The following code executes and gives the result.
A = partitions(3);
total_number_of_partitions = length(A)
idx = randperm(total_number_of_partitions,1)
B = A(idx)
partdisp(B)
In this code i am using randperm to display any partition.
Could anyone help me how to display the partition which I required.
For example if I want to display idx=5,how the command line idx = randperm(total_number_of_partitions,1) can be changed.
  2 件のコメント
Rik
Rik 2019 年 4 月 23 日
I'm done. I lost count of how many time you post a question where you ask for a specific value to be assigned when using a random number generator. Either use idx=5 or idx=randperm(total_number_of_partitions,1). Please stop posting semi-duplicate questions with meaningless titles ("please help" provides no information whatsoever).
Walter Roberson
Walter Roberson 2019 年 4 月 23 日
We went through the same thing with you about 15 months ago.
You can change the random number generator seed to force the next generated value to be any particular value you want.
By trying each possible seed from 1 to 1E5, you can show that it takes no more than 1E5 probes to find a seed that will produce any 5 given random numbers in a row when using randi(6)

回答 (1 件)

Raj
Raj 2019 年 4 月 23 日
Use
display(randperm(total_number_of_partitions,1),'idx')
  2 件のコメント
jaah navi
jaah navi 2019 年 4 月 23 日
i am getting error stating Error using display
Too many output arguments.
Raj
Raj 2019 年 4 月 23 日
Do you want idx=5 only OR you just want to display whatever randperm(total_number_of_partitions,1) gives as value for idx?
Because I understood your question as second part. The command I pasted works perfectly for me. I am using MATLAB 2016a version. see screenshot. I have used a random number for total_number_of_partitions just to show.

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by