Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

could anyone help me how to solve the issue.

1 visualización (últimos 30 días)
jaah navi
jaah navi el 23 de Abr. de 2019
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
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 comentarios
Rik
Rik el 23 de Abr. de 2019
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 el 23 de Abr. de 2019
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)

Respuestas (1)

Raj
Raj el 23 de Abr. de 2019
Use
display(randperm(total_number_of_partitions,1),'idx')
  2 comentarios
jaah navi
jaah navi el 23 de Abr. de 2019
i am getting error stating Error using display
Too many output arguments.
Raj
Raj el 23 de Abr. de 2019
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.

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by